[issue39960] Using typename.__setattr__ in extension type with Py_TPFLAGS_HEAPTYPE is broken (hackcheck too eager?)
New submission from Matthias Braun : This is about an extension type created via `PyType_FromSpec` that overrides `tp_setattro` (minimal example attached). In this case cpython does not let me grab and use the `__setattr__` function "manually". Example: ``` >>> import demo >>> mytype_setattr = demo.MyType.__setattr__ >>> i = demo.MyType() >>> mytype_setattr(i, "foo", "bar") Traceback (most recent call last): File "", line 1, in TypeError: can't apply this __setattr__ to object object ``` I suspect this is related to the loop at the beginning of typeobject.c / hackcheck() that skips over types with Py_TPFLAGS_HEAPOBJECT. (Though removing the loop breaks things like the enum module). ------ components: C API files: demomodule.zip messages: 364123 nosy: Matthias Braun priority: normal severity: normal status: open title: Using typename.__setattr__ in extension type with Py_TPFLAGS_HEAPTYPE is broken (hackcheck too eager?) versions: Python 3.7 Added file: https://bugs.python.org/file48974/demomodule.zip ___ Python tracker <https://bugs.python.org/issue39960> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26067] test_shutil fails when gid name is missing
Matthias Braun added the comment: I have the same issue on my work macbook which has some form of network login configured. The primary group id of my user account there cannot be found in the group database and cannot be resolved to a name. I'm not sure why that is but I am pretty sure there is no obligation that a gid must be resolvable to a name. I submitted a PR to just skip the last part of the test_shutil/chown if the uid/gid cannot be resolved to a name. -- nosy: +Matthias Braun ___ Python tracker <https://bugs.python.org/issue26067> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36017] test_grp
Change by Matthias Braun : -- keywords: +patch nosy: +Matthias Braun nosy_count: 1.0 -> 2.0 pull_requests: +18382 stage: -> patch review pull_request: https://github.com/python/cpython/pull/19033 ___ Python tracker <https://bugs.python.org/issue36017> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39986] test_os / test_listdir failed as root-directory changed during test
New submission from Matthias Braun : The test_listdir test from Lib/test/test_os.py is using os.listdir() twice in the root directory with and without parameters and compares the results. I just had the test fail for me, because an unrelated process happened to create a file in the root directory between the two invocations of os.listdir. In my case it was rsyslog creating '/imjournal.state.tmp', but the problem is a general one. The test failed with: ``` ..test test_os failed -- Traceback (most recent call last): File "/home/matthiasb/dev/fbcpython/Lib/test/test_os.py", line 1914, in test_listdir self.assertEqual(set(os.listdir()), set(os.listdir(os.sep))) AssertionError: Items in the first set but not the second: 'imjournal.state.tmp' ``` -- components: Tests messages: 364383 nosy: Matthias Braun priority: normal severity: normal status: open title: test_os / test_listdir failed as root-directory changed during test type: behavior versions: Python 3.7 ___ Python tracker <https://bugs.python.org/issue39986> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39986] test_os / test_listdir failed as root-directory changed during test
Change by Matthias Braun : -- keywords: +patch pull_requests: +18386 stage: -> patch review pull_request: https://github.com/python/cpython/pull/19035 ___ Python tracker <https://bugs.python.org/issue39986> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5944] test_os failure on OS X, probably related to PEP 383
Matthias Braun added the comment: I believe my suggested pull request in https://bugs.python.org/issue39986 may solve this issue as a side effect because we no longer list the root directory but a temporary directory with controlled filenames. -- nosy: +Matthias Braun ___ Python tracker <https://bugs.python.org/issue5944> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38454] test_listdir is failing on ubuntu with WSL
Matthias Braun added the comment: I believe my suggested pull request in https://bugs.python.org/issue39986 may solve this issue as a side effect because we no longer list the root directory but a temporary directory with controlled filenames. -- nosy: +Matthias Braun ___ Python tracker <https://bugs.python.org/issue38454> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2897] Deprecate structmember.h
Matthias Braun added the comment: This wasn't mentioned before: Having PyMemberDef part of the structmember.h is a big problem for users of PEP384/limited API, because structmember.h is not part of it. Which results in the odd situation that `Py_tp_members` or `PyDescr_NewMember()` are part of the limited API but technically you cannot use it because you are not supposed to include headers that are not part of `Python.h`. The proposed patch here, would fix this! -- nosy: +Matthias Braun ___ Python tracker <https://bugs.python.org/issue2897> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2897] Deprecate structmember.h
Change by Matthias Braun : -- components: +C API versions: +Python 3.10 -Python 3.8 ___ Python tracker <https://bugs.python.org/issue2897> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2897] Deprecate structmember.h
Matthias Braun added the comment: > The issue title is misleading, it says "Deprecate structmember.h". Is the > plan still to deprecate it? Or to make it usable in the limited C API? Please > update the title. As far as I understand it: The attached diff, moves the interesting declaration to `object.h` solving the limited API problem. And only leaves structmember.h around for backward compatibility for people using the "old" names `READONLY` or `RESTRICTED`. So in that sense it does deprecate structmember.h But indeed I hijacked this issue with my complaints about the limited API which may not have been the original intention here, but they get solved nonetheless. -- ___ Python tracker <https://bugs.python.org/issue2897> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2897] PyMemberDef missing in limited API / Deprecate structmember.h
Change by Matthias Braun : -- title: Deprecate structmember.h -> PyMemberDef missing in limited API / Deprecate structmember.h ___ Python tracker <https://bugs.python.org/issue2897> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2897] PyMemberDef missing in limited API / Deprecate structmember.h
Matthias Braun added the comment: Happy to take the proposed diff here (assuming @belopolsky wont mind) and include it into a pull request that also renames the uses of the READONLY flags (and maybe removes the RESTRICTED flags) within cpython source itself. -- ___ Python tracker <https://bugs.python.org/issue2897> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2897] PyMemberDef missing in limited API / Deprecate structmember.h
Change by Matthias Braun : -- pull_requests: +19715 stage: commit review -> patch review pull_request: https://github.com/python/cpython/pull/20462 ___ Python tracker <https://bugs.python.org/issue2897> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2897] PyMemberDef missing in limited API / Deprecate structmember.h
Matthias Braun added the comment: While working on the pull request I felt that the type and constants better fit `descrobject.h` rather than `object.h`. -- ___ Python tracker <https://bugs.python.org/issue2897> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3290] python-config --cflags includes irrelevant flags
Matthias Braun added the comment: I hacked up a proof-of-concept patch which filters out the most annoying flags (warnings, -Ox and -DNDEBUG flags). (Though IMO the only really robust solution would be not having code but just declarations in the public headers, so --includes is enough. In my personal project I ended up to just use --includes and manually make sure that I don't use any of the code in the headers, but just the declarations). -- keywords: +patch nosy: +Matthias.Braun Added file: http://bugs.python.org/file29310/python-config-filter-cflags.patch ___ Python tracker <http://bugs.python.org/issue3290> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3290] python-config --cflags includes irrelevant flags
Matthias Braun added the comment: It's less of a problem when building python extenions, where you are probably fine with using "just the same" as the installed python. However in my case I am embedding python as a scripting language into another application. So there is very few python related code and alot of other code. The python-config script "injecting" unnecessary build flags that in fact even change things (-DNDEBUG) is very annoying as it changes all the non-python code too. A simple thing like the --includes that just outputs the -I flags would be the best solution IMO. But to have this working you would need to have a guarantee that there is no actual code in the form of #define / inline functions in the headers which potentially breaks if you use different flags from the python library. In fact --includes is what I am using now, I just hope that I won't hit any of the preproc macros by accident... -- ___ Python tracker <http://bugs.python.org/issue3290> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com