Skip to content

bpo-46417: Add missing types of _PyTypes_InitTypes() #30749

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 21, 2022
Merged

bpo-46417: Add missing types of _PyTypes_InitTypes() #30749

merged 1 commit into from
Jan 21, 2022

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Jan 21, 2022

Add types removed by mistake by the commit adding
_PyTypes_FiniTypes().

Move also PyBool_Type at the end, since it depends on PyLong_Type.

PyBytes_Type and PyUnicode_Type no longer depend explicitly on
PyBaseObject_Type: it's the default of PyType_Ready().

https://bugs.python.org/issue46417

@vstinner
Copy link
Member Author

This change doesn't fix the crash, Ubuntu failed on Azure Pipelines PR:

test_mock_add_spec (unittest.test.testmock.testmock.MockTest) ... Fatal Python error: Segmentation fault

Current thread 0x00007fda98424280 (most recent call first):
  File "/home/vsts/work/1/s/Lib/inspect.py", line 2179 in _signature_fromstr
  File "/home/vsts/work/1/s/Lib/inspect.py", line 2273 in _signature_from_builtin
  File "/home/vsts/work/1/s/Lib/inspect.py", line 2461 in _signature_from_callable
  File "/home/vsts/work/1/s/Lib/inspect.py", line 2465 in _signature_from_callable
  File "/home/vsts/work/1/s/Lib/inspect.py", line 2966 in from_callable
  File "/home/vsts/work/1/s/Lib/inspect.py", line 3218 in signature
  File "/home/vsts/work/1/s/Lib/unittest/mock.py", line 112 in _get_signature_object
  File "/home/vsts/work/1/s/Lib/unittest/mock.py", line 505 in _mock_add_spec
  File "/home/vsts/work/1/s/Lib/unittest/mock.py", line 487 in mock_add_spec
  File "/home/vsts/work/1/s/Lib/unittest/test/testmock/testmock.py", line 1781 in test_mock_add_spec
...

I wrote a different change: PR #30750.

Add types removed by mistake by the commit adding
_PyTypes_FiniTypes().

Move also PyBool_Type at the end, since it depends on PyLong_Type.

PyBytes_Type and PyUnicode_Type no longer depend explicitly on
PyBaseObject_Type: it's the default of PyType_Ready().
@vstinner
Copy link
Member Author

I wrote a different change: PR #30750.

PR #30750 is merged. I rebase this PR to top of it to see if it does fix the test_unittest crash.

@vstinner vstinner merged commit a1bf329 into python:main Jan 21, 2022
@vstinner vstinner deleted the init_types branch January 21, 2022 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants