Skip to content
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

gh-78878: Fix crash when creating an instance of _ctypes.CField #14837

Merged
merged 9 commits into from Dec 21, 2022

Conversation

shihai1991
Copy link
Member

@shihai1991 shihai1991 commented Jul 18, 2019

@shihai1991
Copy link
Member Author

shihai1991 commented Jul 18, 2019

@serhiy-storchaka @izbyshev Hi, guys. I have try to solve this probleam, pls review this patch, thank you :)

Copy link
Contributor

@MaxwellDupre MaxwellDupre left a comment

unittest Lib/ctypes/test/test_struct_fields.py
Ran 8 tests in 0.005s
OK
Looks ok.

@kumaraditya303
Copy link
Contributor

kumaraditya303 commented Jul 3, 2022

@shihai1991 Can you fix the conflicts ? Thanks

@shihai1991
Copy link
Member Author

shihai1991 commented Jul 8, 2022

@shihai1991 Can you fix the conflicts ? Thanks

Of course. Thanks for your review. I forget detail already. I will take a look again.

iritkatriel
iritkatriel previously requested changes Dec 6, 2022
Copy link
Member

@iritkatriel iritkatriel left a comment

This has merge conflicts now.

@bedevere-bot
Copy link

bedevere-bot commented Dec 6, 2022

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

shihai1991 added 2 commits Dec 18, 2022
* origin/main: (1306 commits)
  Correct CVE-2020-10735 documentation (python#100306)
  pythongh-100272: Fix JSON serialization of OrderedDict (pythonGH-100273)
  pythongh-93649: Split tracemalloc tests from _testcapimodule.c (python#99551)
  Docs: Use `PY_VERSION_HEX` for version comparison (python#100179)
  pythongh-97909: Fix markup for `PyMethodDef` members (python#100089)
  pythongh-99240: Reset pointer to NULL when the pointed memory is freed in argument parsing (python#99890)
  pythongh-99240: Reset pointer to NULL when the pointed memory is freed in argument parsing (python#99890)
  pythonGH-98831: Add DECREF_INPUTS(), expanding to DECREF() each stack input (python#100205)
  pythongh-78707: deprecate passing >1 argument to `PurePath.[is_]relative_to()` (pythonGH-94469)
  pythongh-99540: Constant hash for _PyNone_Type to aid reproducibility (pythonGH-99541)
  pythongh-100039: enhance __signature__ to work with str and callables (pythonGH-100168)
  pythongh-99830: asyncio: Document returns of remove_{reader,writer} (python#100302)
  "Compound statement" docs: Fix with-statement step indexing (python#100286)
  pythonGH-90043: Handle NaNs in COMPARE_OP_FLOAT_JUMP (pythonGH-100278)
  Improve stats presentation for calls. (pythonGH-100274)
  Better stats for `LOAD_ATTR` and `STORE_ATTR` (pythonGH-100295)
  pythongh-81057: Move the Cached Parser Dummy Name to _PyRuntimeState (python#100277)
  Document that zipfile's pwd parameter is a `bytes` object (python#100209)
  pythongh-99767: mark `PyTypeObject.tp_watched` as internal use only in table (python#100271)
  Fix typo in introduction.rst (python#100266)
  ...
@shihai1991 shihai1991 changed the title bpo-34697: Deleteing PyCField_new function gh-78878: Deleteing PyCField_new function Dec 18, 2022
@shihai1991
Copy link
Member Author

shihai1991 commented Dec 18, 2022

Resolve the conflict again :)

@shihai1991
Copy link
Member Author

shihai1991 commented Dec 18, 2022

I have made the requested changes; please review again

@bedevere-bot
Copy link

bedevere-bot commented Dec 18, 2022

Thanks for making the requested changes!

@iritkatriel: please review the changes made to this pull request.

@bedevere-bot bedevere-bot requested a review from iritkatriel Dec 18, 2022
@iritkatriel iritkatriel dismissed their stale review Dec 18, 2022

Merge conflict was resolved.

@iritkatriel iritkatriel requested a review from vstinner Dec 18, 2022
@kumaraditya303 kumaraditya303 changed the title gh-78878: Deleteing PyCField_new function gh-78878: Fix crash when creating an instance of _ctypes.CField Dec 19, 2022
Copy link
Contributor

@kumaraditya303 kumaraditya303 left a comment

LGTM

@kumaraditya303 kumaraditya303 merged commit d713c54 into python:main Dec 21, 2022
16 checks passed
@miss-islington
Copy link
Contributor

miss-islington commented Dec 21, 2022

Thanks @shihai1991 for the PR, and @kumaraditya303 for merging it 🌮🎉.. I'm working now to backport this PR to: 3.10, 3.11.
🐍🍒🤖

@miss-islington
Copy link
Contributor

miss-islington commented Dec 21, 2022

Sorry, @shihai1991 and @kumaraditya303, I could not cleanly backport this to 3.10 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker d713c54ac8a2eba0616a5a07714696d935f1062e 3.10

@bedevere-bot
Copy link

bedevere-bot commented Dec 21, 2022

GH-100413 is a backport of this pull request to the 3.11 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Dec 21, 2022
…d` (pythonGH-14837)

(cherry picked from commit d713c54)

Co-authored-by: Hai Shi <shihai1992@gmail.com>
@kumaraditya303
Copy link
Contributor

kumaraditya303 commented Dec 21, 2022

Let's only backport to 3.11.

miss-islington added a commit that referenced this pull request Dec 21, 2022
…-14837)

(cherry picked from commit d713c54)

Co-authored-by: Hai Shi <shihai1992@gmail.com>
@bedevere-bot
Copy link

bedevere-bot commented Dec 21, 2022

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot wasm32-emscripten node (pthreads) 3.x has failed when building commit d713c54.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/all/#builders/1050/builds/1054) and take a look at the build logs.
  4. Check if the failure is related to this commit (d713c54) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/all/#builders/1050/builds/1054

Failed tests:

  • test_fileio

Failed subtests:

  • testErrnoOnClosedTruncate - test.test_fileio.CAutoFileTests.testErrnoOnClosedTruncate

Summary of the results of the build (if available):

== Tests result: FAILURE ==

338 tests OK.

10 slowest tests:

  • test_tokenize: 1 min 12 sec
  • test_io: 44.3 sec
  • test_capi: 35.6 sec
  • test_lib2to3: 35.6 sec
  • test_unparse: 35.2 sec
  • test_zipfile: 29.9 sec
  • test_unicodedata: 21.8 sec
  • test_argparse: 19.1 sec
  • test_pickle: 19.0 sec
  • test_weakref: 13.0 sec

1 test failed:
test_fileio

94 tests skipped:
test__xxsubinterpreters test_asyncgen test_asyncio
test_check_c_globals test_clinic test_cmd_line
test_concurrent_futures test_contextlib_async test_ctypes
test_curses test_dbm_gnu test_dbm_ndbm test_devpoll test_doctest
test_docxmlrpc test_dtrace test_embed test_epoll test_faulthandler
test_fcntl test_file_eintr test_fork1 test_ftplib test_gdb
test_grp test_httplib test_httpservers test_idle test_imaplib
test_interpreters test_ioctl test_kqueue test_launcher test_lzma
test_mmap test_msilib test_multiprocessing_fork
test_multiprocessing_forkserver test_multiprocessing_main_handling
test_multiprocessing_spawn test_nis test_openpty test_ossaudiodev
test_pdb test_peg_generator test_perf_profiler test_poll
test_poplib test_pty test_pwd test_readline test_regrtest
test_repl test_resource test_select test_selectors test_smtplib
test_smtpnet test_socket test_socketserver test_spwd test_ssl
test_stable_abi_ctypes test_startfile test_subprocess
test_sys_settrace test_syslog test_tcl test_telnetlib test_tix
test_tkinter test_tools test_ttk test_ttk_textonly test_turtle
test_urllib2 test_urllib2_localnet test_urllib2net test_urllibnet
test_venv test_wait3 test_wait4 test_webbrowser test_winconsoleio
test_winreg test_winsound test_wmi test_wsgiref test_xmlrpc
test_xmlrpc_net test_xxlimited test_zipfile64
test_zipimport_support test_zoneinfo
0:21:38 load avg: 8.24
0:21:38 load avg: 8.24 Re-running failed tests is not supported with --python host runner option.

Total duration: 21 min 38 sec

Click to see traceback logs
Traceback (most recent call last):
  File "/opt/buildbot/bcannon-wasm/3.x.bcannon-wasm.emscripten-node-pthreads/build/Lib/test/test_fileio.py", line 272, in wrapper
    self.assertEqual(e.errno, errno.EBADF)
AssertionError: 28 != 8


Traceback (most recent call last):
  File "/opt/buildbot/bcannon-wasm/3.x.bcannon-wasm.emscripten-node-pthreads/build/Lib/test/test_fileio.py", line 270, in wrapper
    func(self, f)
  File "/opt/buildbot/bcannon-wasm/3.x.bcannon-wasm.emscripten-node-pthreads/build/Lib/test/test_fileio.py", line 300, in testErrnoOnClosedTruncate
    f.truncate(0)
OSError: [Errno 28] Invalid argument

@shihai1991
Copy link
Member Author

shihai1991 commented Dec 22, 2022

It's an very old MR. Thanks everyone's review. Thanks Kumar for your merge.

@shihai1991 shihai1991 deleted the bpo_34697 branch Dec 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants