Commit Graph

114143 Commits

Author SHA1 Message Date
Serhiy Storchaka 68c555a50a
gh-95041: Fix several minor issues in syslog.openlog() (GH-95058)
* syslog_get_argv() swallows exceptions, but not in all cases.
* if ident is non UTF-8 encodable, syslog.openlog() fails after setting the
  global reference to ident. Now the C string saved internally in the previous
  call to openlog() points to the freed memory.
* PySys_Audit() can crash if ident is NULL.
* There may be a race condition with syslog.syslog(), because the global
  reference to ident is decrefed before setting the new value.
* Possible use of freed memory if syslog.openlog() is called while
  the GIL is released in syslog.syslog().
2022-07-26 09:12:10 +03:00
Pieter Eendebak 2ef73be891
gh-91247: Use memcpy for list and tuple repeat (#91482)
* Add _Py_memory_repeat function to pycore_list

* Add _Py_RefcntAdd function to pycore_object

* Use the new functions in tuplerepeat, list_repeat, and list_inplace_repeat
2022-07-25 22:10:23 -04:00
Mark Shannon 27055d766a
GH-92678: Expose managed dict clear and visit functions (#95246) 2022-07-25 22:30:53 +01:00
Eric Snow 2d26449b06
gh-94673: Always Finalize Static Builtin Types (#95153)
Static builtin types are finalized by calling _PyStaticType_Dealloc().  Before this change, we were skipping finalizing such a type if it still had subtypes (i.e. its tp_subclasses hadn't been cleared yet).  The problem is that types hold several heap objects, which leak if we skip the type's finalization.  This change addresses that.

For context, there's an old comment (from e9e3eab0b8) that says the following:

   // If a type still has subtypes, it cannot be deallocated.
   // A subtype can inherit attributes and methods of its parent type,
   // and a type must no longer be used once it's deallocated.

However, it isn't clear that is actually still true.  Clearing tp_dict should mean it isn't a problem.

Furthermore, the only subtypes that might still be around come from extension modules that didn't clean them up when unloaded (i.e. extensions that do not implement multi-phase initialization, AKA PEP 489).  Those objects are already leaking, so this change doesn't change anything in that regard.  Instead, this change means more objects gets cleaned up that before.
2022-07-25 14:23:41 -06:00
Dong-hee Na a15ae19ffb
gh-85454: Remove distutils.ccompiler from Tools/c-analyzer (GH-95171) 2022-07-25 21:10:30 +02:00
Eric Snow 4a1dd73431
gh-94673: Add _PyStaticType_InitBuiltin() (#95152)
This is the first of several precursors to storing tp_subclasses (and tp_weaklist) on the interpreter state for static builtin types.

We do the following:

* add `_PyStaticType_InitBuiltin()`
* add `_Py_TPFLAGS_STATIC_BUILTIN`
* set it on all static builtin types in `_PyStaticType_InitBuiltin()`
* shuffle some code around to be able to use _PyStaticType_InitBuiltin()
    * rename `_PyStructSequence_InitType()` to `_PyStructSequence_InitBuiltinWithFlags()`
    * add `_PyStructSequence_InitBuiltin()`.
2022-07-25 12:47:31 -06:00
Oleg Iarygin c5140945c7
gh-92546: Move pprint benchmark into pyperformance (GH-94613)
This PR couples with https://github.com/python/pyperformance/pull/222 and supersedes https://github.com/python/cpython/pull/92560. Inspired by https://github.com/python/cpython/issues/93096#issuecomment-1134576471.

Automerge-Triggered-By: GH:ericsnowcurrently
2022-07-25 11:30:13 -07:00
Ethan Furman 4e704d7847
gh-95077: [Enum] add code-based deprecation warnings for member.member access (GH-95083)
* issue deprecation warning for member.member access
* always store member property in current class
* remove __getattr__
2022-07-25 11:05:10 -07:00
Kumar Aditya 73ee5a6b86
GH-94851: check refcnt of immortal objects after finalization (GH-95001) 2022-07-25 10:43:59 -07:00
Erlend Egeberg Aasland ac6a94c669
gh-95235: Document undocumented parameters in sqlite3 functions and methods (#95236)
Co-authored-by: CAM Gerlach <CAM.Gerlach@Gerlach.CAM>
2022-07-25 18:46:55 +02:00
Hugo van Kemenade 10b12dd92a
gh-93963: Document importlib.abc deprecations (#94546) 2022-07-25 18:24:42 +02:00
Petr Viktorin ccd7c7a0bd
gh-93610: Improve docs for importlib.resources (#93611)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Stanley <46876382+slateny@users.noreply.github.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2022-07-25 18:16:17 +02:00
Christian Heimes a566912049
gh-85454: Remove distutils documentation (#95239)
Most places now refer to setuptools or link to setuptools documentation.
Some examples like zipapp need to be updated later.
2022-07-25 15:50:46 +02:00
Oleg Iarygin d58be48369
gh-85454: Remove links from historical mentions of distutils (GH-95192) 2022-07-25 12:20:09 +02:00
Adam Dangoor df7c8b9537
gh-95233: Correct grp.getgrgid parameter name in documentation (gid -> id) (gh-95232) 2022-07-25 18:54:42 +09:00
Erlend Egeberg Aasland 310f94871a
gh-95205: Improve wasm README (#95206)
Co-authored-by: Christian Heimes <christian@python.org>
2022-07-25 09:42:50 +02:00
Serhiy Storchaka ea5ed0ba51
gh-95087: Fix IndexError in parsing invalid date in the email module (GH-95201)
Co-authored-by: wouter bolsterlee <wouter@bolsterl.ee>
2022-07-25 09:17:25 +03:00
Christian Heimes 5956de16cd
gh-95212: make multiprocessing test case parallel-safe (GH-95213) 2022-07-25 06:44:40 +02:00
Jason R. Coombs 3e718cf880
gh-95218: Move tests for importlib.resources into test_importlib.resources. (#95219)
* gh-95218: Move tests for importlib.resources into test_importlib.resources.

* Also update makefile

* Include test_importlib/resources in code ownership rule.
2022-07-24 20:53:10 -04:00
Pablo Galindo Salgado 9007dec606
gh-95173: Revert commit 51ed2c56a1 (#95176) 2022-07-24 22:33:06 +01:00
Thomas Grainger 0c6f898005
gh-95051: ensure that timeouts scheduled with `asyncio.Timeout` that have already expired are deliverered promptly (#95109)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-07-24 13:18:05 -07:00
Raymond Hettinger eb9c8a8bea
log2() is faster than log() (#95214) 2022-07-24 14:21:29 -05:00
Pablo Galindo Salgado 0047447294
gh-95185: Check recursion depth in the AST constructor (#95186)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-07-24 15:58:52 +01:00
Stéphane Bidoul 3c94d3395e
gh-95199: upgrade bundled setuptools to 63.2.0 (gh-95200) 2022-07-24 12:01:03 +01:00
Stéphane Bidoul 068ffafa54
gh-95194: upgrade bundled pip to 22.2 (gh-95195)
upgrade bundled pip to 22.2
2022-07-24 10:55:25 +01:00
Christian Heimes 8184f0fce3
gh-95174: Handle missing waitpid and gethostbyname in WASI (GH-95181) 2022-07-24 08:04:06 +02:00
Inada Naoki 5c7f3bcdaf
gh-93157: Fix fileinput didn't support `errors` in `inplace` mode (GH-95128) 2022-07-24 11:42:11 +09:00
Raymond Hettinger a2fbc51198
Compute v only when needed. (#95183) 2022-07-23 18:07:17 -05:00
Christian Heimes 23f6944c37
gh-90385: Add skip_unless_symlink decorator to test_walk_symlink_location (GH-95182) 2022-07-23 23:42:04 +02:00
Pablo Galindo Salgado 9762572d0a
gh-93351: Add news entry and what's new entry for changes in gh-93351 (#95175) 2022-07-23 19:35:44 +01:00
Christian Heimes d291a82df3
gh-90473: Check for HAVE_KILL in main.c:exit_sigint (GH-95165) 2022-07-23 12:29:00 +02:00
Christian Heimes 6839324894
gh-90473: Fix more tests on platforms without umask (GH-95164) 2022-07-23 12:26:31 +02:00
Christian Heimes 41a5b84eaf
gh-89758: Track all socket module dependencies (#95157) 2022-07-23 11:34:50 +02:00
Chenwei Xiao de28ee8f75
Doc: Add omitted secondary prompt in inputoutput tutorial (GH-30317)
For the continuation lines, "..." should present as secondary prompt
2022-07-23 17:25:42 +08:00
Erlend Egeberg Aasland a3d4d15f53
gh-95132: Correctly relay *args and **kwds from sqlite3.connect to factory (#95146)
This PR partially reverts gh-24421 (PR) and fixes the remaining concerns
given in gh-93044 (issue):

- keyword arguments are passed as positional arguments to factory()
- if an argument is not passed to sqlite3.connect(), its default value
  is passed to factory()

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-07-23 09:51:28 +02:00
Stanislav Zmiev c1e929858a
gh-90385: Add `pathlib.Path.walk()` method (GH-92517)
Automerge-Triggered-By: GH:brettcannon
2022-07-22 16:55:46 -07:00
Brandt Bucher e4d3a96a11
GH-94438: Handle extended arguments and conditional pops in mark_stacks (GH-95110) 2022-07-22 16:28:03 -07:00
Brandt Bucher 900bfc53cb
GH-94036: Fix more attribute location quirks (GH-95028) 2022-07-22 13:13:16 -07:00
Chenwei Xiao 34d11f1b0c
Fix copy-friendliness of tutorial example (GH-93424) 2022-07-22 15:11:48 -05:00
Brandt Bucher e402b26b7f
GH-95113: Don't use EXTENDED_ARG_QUICK in unquickened code (GH-95121) 2022-07-22 11:04:20 -07:00
July Tikhonov 79d2f549ad
Fix async method reference links in `compound_stmts` docs (GH-94935) 2022-07-22 12:03:17 -05:00
Frank Dana 9c47cf337c
Fix scheme count in `sysconfig` whatsnew entry (GH-94110) 2022-07-22 11:51:14 -05:00
oda-gitso 346aabf916
Fix incorrect directive in multiprocessing module documentation (GH-93517) 2022-07-22 11:46:42 -05:00
Alexandru Mărășteanu 2a9c227ac1
Closes gh-95133: docs, fix indentation level in TestCase.assertLogs example (GH-95134) 2022-07-22 11:37:22 -05:00
Mariatta Wijaya 8a808952a6
Use Markdown Headers in GitHub Issue templates (GH-95111)
The Issue templates are using the markup to make text bold.
We should be using proper text headers instead.

I replaced the **bold** text markup with L1 headers.
2022-07-22 09:19:08 -07:00
Erlend Egeberg Aasland f9b3706df6
gh-81040: Improve sqlite3.Cursor.rowcount docs (#94940) 2022-07-22 09:34:39 +02:00
David Benjamin 934b25dcc4
Fix typo in PROTOCOL_TO_TLS_VERSION in test_ssl (GH-95119)
This appears to be a typo. It causes try_protocol_combo to try to turn
on SSL 3.0 when testing PROTOCOL_SSLv23 (aka PROTOCOL_TLS), which
doesn't make any sense. Fix it to be PROTOCOL_SSLv3.

Without this, try_protocol_combo is actually setting
context.minimum_version to SSLv3 when called as
try_protocol_combo(ssl.PROTOCOL_TLS, ssl.PROTOCOL_TLS, True)

One would think this causes a no-ssl3 OpenSSL build to fail, but OpenSSL
forgot to make SSL_CTX_set_min_proto_version(SSL3_VERSION) does not
notice no-ssl3, so this typo has gone undetected. But we should still
fix the typo because, presumably, a future version of OpenSSL will
remove SSL 3.0 and do so more thoroughly, at which point this will
break.
2022-07-21 17:38:15 -07:00
Terry Jan Reedy d06c552e35
gh-95112: Fix What's New 3.12 contribution note periods (#95118)
A couple, so far, are missing.
2022-07-21 20:36:53 -04:00
Terry Jan Reedy 8df8ef9743
gh-95112: Fix What's New 3.11 contribution note periods (#95115)
Some are missing, a few placed after the ')'.
2022-07-21 20:35:56 -04:00
Terry Jan Reedy c944649ffc
gh-95112: Fix What's New 3.10 contribution note periods (#95114)
Some are missing, a few placed after the ')'.
One ') was missing.
2022-07-21 20:00:52 -04:00