Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-108512: Add and use new replacements for PySys_GetObject()#111035

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from1 commit
Commits
Show all changes
24 commits
Select commitHold shift + click to select a range
4d0f508
gh-108512: Add and use new replacements for PySys_GetObject()
serhiy-storchakaSep 20, 2023
eb42b39
Update Misc/stable_abi.toml
serhiy-storchakaOct 18, 2023
2d4588d
Merge branch 'main' into capi-PySys_GetAttr
serhiy-storchakaOct 18, 2023
2eb9533
Add tests.
serhiy-storchakaOct 19, 2023
9fc2f3d
Apply suggestions from code review
serhiy-storchakaOct 19, 2023
65713ce
Address review comments.
serhiy-storchakaOct 19, 2023
e6ecf11
Check that the name is a string.
serhiy-storchakaOct 19, 2023
8a0f5f2
Merge remote-tracking branch 'refs/remotes/origin/capi-PySys_GetAttr'…
serhiy-storchakaOct 19, 2023
516829e
Make the new C API not public.
serhiy-storchakaOct 19, 2023
9503aaf
Remove from Misc/stable_abi.toml.
serhiy-storchakaOct 19, 2023
e2857ef
Merge branch 'main' into capi-PySys_GetAttr
serhiy-storchakaJan 28, 2025
dc26ec2
Add to the limited C API.
serhiy-storchakaJan 28, 2025
104dcc2
Replace few new occurrences of PySys_GetObject().
serhiy-storchakaJan 28, 2025
cf75fc3
Update the documentation.
serhiy-storchakaJan 28, 2025
9434659
Clean up.
serhiy-storchakaJan 28, 2025
56639d8
Fix a typo.
serhiy-storchakaJan 28, 2025
b40a665
Merge branch 'main' into capi-PySys_GetAttr
serhiy-storchakaFeb 6, 2025
03b9c0a
Merge branch 'main' into capi-PySys_GetAttr
serhiy-storchakaFeb 6, 2025
5d793c5
Merge remote-tracking branch 'refs/remotes/origin/capi-PySys_GetAttr'…
serhiy-storchakaFeb 6, 2025
09869ed
Merge branch 'main' into capi-PySys_GetAttr
serhiy-storchakaFeb 25, 2025
439bc3c
Merge branch 'main' into capi-PySys_GetAttr
serhiy-storchakaMay 21, 2025
93ab31b
Move to 3.15.
serhiy-storchakaMay 21, 2025
154a82a
Address review comments.
serhiy-storchakaMay 22, 2025
81c7605
Improve tests.
serhiy-storchakaMay 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
Merge branch 'main' into capi-PySys_GetAttr
  • Loading branch information
@serhiy-storchaka
serhiy-storchaka committedFeb 6, 2025
commitb40a6658f9d136c0067628b859bbb4ff56df8bc9
21 changes: 7 additions & 14 deletionsModules/_ctypes/callbacks.c
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -102,10 +102,7 @@ TryAddRef(PyObject *cnv, CDataObject *obj)
}
int r = PyDict_Contains(attrdict, &_Py_ID(_needs_com_addref_));
if (r <= 0) {
if (r < 0) {
PySys_WriteStderr("getting _needs_com_addref_");
}
return;
return r;
}

punk = *(IUnknown **)obj->b_ptr;
Expand DownExpand Up@@ -152,8 +149,7 @@ static void _CallPythonObject(ctypes_state *st,
if (info && info->getfunc && !_ctypes_simple_instance(st, cnv)) {
PyObject *v = info->getfunc(*pArgs, info->size);
if (!v) {
PySys_WriteStderr("create argument %zd:\n", i);
goto Done;
goto Error;
}
args[i] = v;
/* XXX XXX XX
Expand All@@ -166,15 +162,13 @@ static void _CallPythonObject(ctypes_state *st,
/* Hm, shouldn't we use PyCData_AtAddress() or something like that instead? */
CDataObject *obj = (CDataObject *)_PyObject_CallNoArgs(cnv);
if (!obj) {
PySys_WriteStderr("create argument %zd:\n", i);
goto Done;
goto Error;
}
if (!CDataObject_Check(st, obj)) {
PyErr_Format(PyExc_TypeError,
"%R returned unexpected result of type %T", cnv, obj);
Py_DECREF(obj);
PySys_WriteStderr("unexpected result of create argument %zd:\n", i);
goto Done;
goto Error;
}
memcpy(obj->b_ptr, *pArgs, info->size);
args[i] = (PyObject *)obj;
Expand All@@ -184,10 +178,9 @@ static void _CallPythonObject(ctypes_state *st,
}
#endif
} else {
PyErr_SetString(PyExc_TypeError,
"cannot build parameter");
PySys_WriteStderr("Parsing argument %zd\n", i);
goto Done;
PyErr_Format(PyExc_TypeError,
"cannot build parameter of type %R", cnv);
goto Error;
}
/* XXX error handling! */
pArgs++;
Expand Down
2 changes: 1 addition & 1 deletionModules/main.c
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -489,7 +489,7 @@ pymain_run_startup(PyConfig *config, int *exitcode)
static int
pymain_run_interactive_hook(int *exitcode)
{
PyObject *hook, *result;
PyObject *hook;
if (PySys_GetOptionalAttrString("__interactivehook__", &hook) < 0) {
goto error;
}
Expand Down
5 changes: 3 additions & 2 deletionsPython/pylifecycle.c
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1779,15 +1779,16 @@ flush_std_files(void)
int status = 0;

if (PySys_GetOptionalAttr(&_Py_ID(stdout), &file) < 0) {
PyErr_FormatUnraisable("Exception ignored on flushing sys.stdout");
status = -1;
}
else if (file != NULL && file != Py_None && !file_is_closed(file)) {
if (_PyFile_Flush(file) < 0) {
PyErr_FormatUnraisable("Exception ignored on flushing sys.stdout");
status = -1;
}
}
if (status < 0) {
PyErr_FormatUnraisable("Exception ignored while flushing sys.stdout");
}
Py_XDECREF(file);

if (PySys_GetOptionalAttr(&_Py_ID(stderr), &file) < 0) {
Expand Down
Loading
You are viewing a condensed version of this merge commit. You can view thefull changes here.

[8]ページ先頭

©2009-2025 Movatter.jp