Commit Graph

106896 Commits

Author SHA1 Message Date
Jason R. Coombs 518835f335
bpo-35967 resolve platform.processor late (GH-12239)
* Replace flag-flip indirection with direct inspection

* Use any for simpler code

* Avoid flag flip and set results directly.

* Resolve processor in a single function.

* Extract processor handling into a namespace (class)

* Remove _syscmd_uname, unused

* Restore platform.processor behavior to match prior expectation (reliant on uname -p in a subprocess).

* Extract '_unknown_as_blank' function.

* Override uname_result to resolve the processor late.

* Add a test intended to capture the expected values from 'uname -p'

* Instead of trying to keep track of all of the possible outputs on different systems (probably a fool's errand), simply assert that except for the known platform variance, uname().processor matches the output of 'uname -p'

* Use a skipIf directive

* Use contextlib.suppress to suppress the error. Inline strip call.

* 📜🤖 Added by blurb_it.

* Remove use of contextlib.suppress (it would fail with NameError if it had any effect). Rely on _unknown_as_blank to replace unknown with blank.

Co-authored-by: blurb-it[bot] <blurb-it[bot]@users.noreply.github.com>
2020-04-16 08:28:09 -04:00
Hakan Çelik 6a5bf15c71
bpo-40209: Use tokenize.open in test_unparse (GH-19399) 2020-04-16 11:11:55 +01:00
Shantanu 01508dcde4
Fix typo in exception thrown by ast.unparse (GH-19534) 2020-04-16 11:10:12 +01:00
Jason R. Coombs e72cbcb346
bpo-35967: Make test_platform.test_uname_processor more lenient to satisfy build bots. (GH-19544)
* bpo-35967: Make test more lenient to satisfy build bots.

* Update Lib/test/test_platform.py

Co-Authored-By: Kyle Stanley <aeros167@gmail.com>

* Expect '' for 'unknown'

Co-authored-by: Kyle Stanley <aeros167@gmail.com>
2020-04-15 19:55:35 -04:00
Ammar Askar 58d6f2ee3a
bpo-40270: Enable json extension in Windows sqlite extension (GH-19528) 2020-04-15 16:19:26 -05:00
Serhiy Storchaka fbf2786c4c
bpo-40257: Output object's own docstring in pydoc (GH-19479) 2020-04-15 23:00:20 +03:00
Russell Davis ba1bcffe5c
bpo-29255: Wait in KqueueSelector.select when no fds are registered (GH-19508)
Also partially fixes bpo-25680 (there's still a discrepancy in behavior
on Windows that needs to be fixed).
2020-04-15 11:57:06 -07:00
Jason R. Coombs 4b4e90a518
bpo-35967: Baseline values for uname -p (GH-12824)
* Add a test intended to capture the expected values from 'uname -p'

* Instead of trying to keep track of all of the possible outputs on different systems (probably a fool's errand), simply assert that except for the known platform variance, uname().processor matches the output of 'uname -p'

* Use a skipIf directive

* Use contextlib.suppress to suppress the error. Inline strip call.
2020-04-15 14:32:01 -04:00
Lysandros Nikolaou 9a4b38f66b
bpo-40267: Fix message when last input character produces a SyntaxError (GH-19521)
When there is a SyntaxError after reading the last input character from
the tokenizer and if no newline follows it, the error message used to be
`unexpected EOF while parsing`, which is wrong.
2020-04-15 11:22:10 -07:00
Jason R. Coombs 574547a75c
Clean up compatibility code in importlib fixtures (#19156) 2020-04-15 13:55:43 -04:00
Victor Stinner 5eca75df03
bpo-40268: Reformat posixmodule.c includes (GH-19536) 2020-04-15 15:07:31 +02:00
Victor Stinner 455df97798
Optimize _Py_strhex_impl() (GH-19535)
Avoid a temporary buffer to create a bytes string: use
PyBytes_FromStringAndSize() to directly allocate a bytes object.

Cleanup also the code: PEP 7 formatting, move variable definitions
closer to where they are used. Fix assertion checking "j" index.
2020-04-15 14:05:24 +02:00
Ammar Askar a86b522d8f
bpo-40277: Add a repr() to namedtuple's _tuplegetter to aid with introspection (GH-19537) 2020-04-14 23:36:08 -07:00
Victor Stinner 4f98f465f1
bpo-40268: Remove unused imports in pylifecycle.c (GH-19533)
Remove unused imports in files:

* initconfig.c
* main.c
* preconfig.h
* pylifecycle.c
* python.c
* pythonrun.c
2020-04-15 04:01:58 +02:00
Victor Stinner 361dcdcefc
bpo-40268: Remove unused osdefs.h includes (GH-19532)
When the include is needed, add required symbol in a comment.
2020-04-15 03:24:57 +02:00
Victor Stinner d9ea5cae1d
bpo-40268: Remove unused pycore_pymem.h includes (GH-19531) 2020-04-15 02:57:50 +02:00
Victor Stinner 4a21e57fe5
bpo-40268: Remove unused structmember.h includes (GH-19530)
If only offsetof() is needed: include stddef.h instead.

When structmember.h is used, add a comment explaining that
PyMemberDef is used.
2020-04-15 02:35:41 +02:00
Victor Stinner 62183b8d6d
bpo-40268: Remove explicit pythread.h includes (#19529)
Remove explicit pythread.h includes: it is always included
by Python.h.
2020-04-15 02:04:42 +02:00
Ethan Smith d01628e411
bpo-39481: PEP 585 for dataclasses, mailbox, contextvars (GH-19425) 2020-04-14 16:14:15 -07:00
Pablo Galindo 33986465bd
bpo-39522: Always initialise kind attribute in constant ast nodes (GH-19525) 2020-04-14 21:40:41 +01:00
Batuhan Taşkaya 43aeefa419
bpo-39522: Use _PyUnicodeWriter_WriteStr instead of PyUnicode_AS_DATA (GH-19523) 2020-04-14 21:21:22 +01:00
Miro Hrončok 4c0a31fb08
bpo-9216: Nobody expects the geohashing FIPS inquisition (GH-19520)
Automerge-Triggered-By: @tiran
2020-04-14 12:49:11 -07:00
Barry d42e582063
bpo-40260: Update modulefinder to use io.open_code() and respect coding comments (GH-19488) 2020-04-14 20:16:06 +01:00
Batuhan Taşkaya aade1cc453
bpo-395222: Correctly unparse unicode prefix in ast_unparse.c (GH-19512) 2020-04-14 19:55:01 +01:00
Zackery Spytz 96515e9f67
bpo-32033: Fix test_pwd failures on Android (GH-19502) 2020-04-14 20:11:46 +02:00
Hai Shi 675d9a3d7a
bpo-40170: Convert PyObject_IS_GC() macro to a function (GH-19464) 2020-04-14 20:11:20 +02:00
Dong-hee Na a5900ecf9f
bpo-40221: Update multiprocessing to use _at_fork_reinit (GH-19511) 2020-04-15 01:35:36 +09:00
Victor Stinner e560f90602
bpo-40268: Move struct _gc_runtime_state to pycore_gc.h (GH-19515) 2020-04-14 18:30:41 +02:00
Victor Stinner 4cf65a630a
regrtest: log timeout at startup (GH-19514)
Reduce also worker timeout.
2020-04-14 18:29:44 +02:00
Dong-hee Na 62f75fe3dd
bpo-40232: Update PyOS_AfterFork_Child() to use _PyThread_at_fork_reinit() (GH-19450) 2020-04-15 01:16:24 +09:00
Victor Stinner e5014be049
bpo-40268: Remove a few pycore_pystate.h includes (GH-19510) 2020-04-14 17:52:15 +02:00
Dong-hee Na e1945307d3
bpo-40221: Update multiprocessing to use _at_fork_reinit (GH-19477) 2020-04-14 22:15:52 +09:00
Victor Stinner 81a7be3fa2
bpo-40268: Rename _PyInterpreterState_GET_UNSAFE() (GH-19509)
Rename _PyInterpreterState_GET_UNSAFE() to _PyInterpreterState_GET()
for consistency with _PyThreadState_GET() and to have a shorter name
(help to fit into 80 columns).

Add also "assert(tstate != NULL);" to the function.
2020-04-14 15:14:01 +02:00
Victor Stinner 4a3fe08353
bpo-40268: Include explicitly pycore_interp.h (GH-19505)
pycore_pystate.h no longer includes pycore_interp.h:
it's now included explicitly in files accessing PyInterpreterState.
2020-04-14 14:26:24 +02:00
Ethan Smith 8ef875028a
bpo-39481: Make weakref and WeakSet generic (GH-19497) 2020-04-13 21:54:40 -07:00
Ethan Smith cecf049673
bpo-39481: Make functools.cached_property, partial, partialmethod generic (#19427) 2020-04-13 21:53:04 -07:00
Benjamin Peterson 584a3cfda4
closes bpo-40266, closes bpo-39953: Use numeric lib code if compiling against old OpenSSL. (GH-19506) 2020-04-13 22:11:40 -05:00
Galden 02152b7332
Fix typo from Lib/asyncio/events.py (GH-19410) 2020-04-14 09:04:32 +09:00
Batuhan Taşkaya 990ea4200f
bpo-40208: Remove deprecated has_exec method of SymbolTable (GH-19396) 2020-04-14 08:51:32 +09:00
Sebastian Pedersen a1a0eb4a39
bpo-39380: Change ftplib encoding from latin-1 to utf-8 (GH-18048)
Add the encoding in ftplib.FTP and ftplib.FTP_TLS to the
constructor as keyword-only and change the default from "latin-1" to "utf-8"
to follow RFC 2640.
2020-04-14 01:07:56 +02:00
Batuhan Taşkaya 258f5179f9
bpo-32894: Support unparsing of infinity numbers in ast_unparser.c (GH-17426) 2020-04-14 00:51:31 +02:00
Victor Stinner 4c3da783cf
bpo-40091: Fix a hang at fork in the logging module (GH-19416)
Fix a hang at fork in the logging module: the new private
_at_fork_reinit() method is now used to reinitialize locks at fork in
the child process.

The createLock() method is no longer used at fork.
2020-04-14 00:25:34 +02:00
Chih-Hsuan Yen 25a6833f79
bpo-39481: fix test_genericalias on Android (GH-19469)
Android bionic does not implement shm_open/shm_unlink [1].
As a result _posixshmem extension does not exist and
multiprocessing.shared_memory cannot be imported.

[1] https://android.googlesource.com/platform/bionic/+/master/docs/status.md
2020-04-13 15:00:16 -07:00
Victor Stinner 0c13e1f96a
bpo-40241: Add pycore_interp.h header (GH-19499)
Move PyInterpreterState and related functions to a new internal
pycore_interp.h header file.
2020-04-13 12:47:17 +02:00
Victor Stinner 1c4cbdf94d
bpo-40268: Add pycore_runtime.h header file (GH-19493)
Move PyRuntimeState from pycore_pystate.h to pycore_runtime.h.

Remove _PyGILState_check_enabled macro: access directly
_PyRuntime.gilstate.check_enabled.
2020-04-13 11:45:21 +02:00
Victor Stinner 0135598d72
bpo-40241: Add pycore_gc.h header file (GH-19494)
Move the PyGC_Head structure and the following private macros to the
internal C API:

* _PyGCHead_FINALIZED()
* _PyGCHead_NEXT()
* _PyGCHead_PREV()
* _PyGCHead_SET_FINALIZED()
* _PyGCHead_SET_NEXT()
* _PyGCHead_SET_PREV()
* _PyGC_FINALIZED()
* _PyGC_PREV_MASK
* _PyGC_PREV_MASK_COLLECTING
* _PyGC_PREV_MASK_FINALIZED
* _PyGC_PREV_SHIFT
* _PyGC_SET_FINALIZED()
* _PyObject_GC_IS_TRACKED()
* _PyObject_GC_MAY_BE_TRACKED()
* _Py_AS_GC(o)

Keep the private _PyGC_FINALIZED() macro in the public C API for
backward compatibility with Python 3.8: make it an alias to the new
PyObject_GC_IsFinalized() function.

Move the SIZEOF_PYGC_HEAD constant from _testcapi module to
_testinternalcapi module.
2020-04-13 11:38:42 +02:00
laike9m 85dd6bb1f6
Improved documentation for `BUILD_CONST_KEY_MAP` (GH-19454) 2020-04-13 10:55:45 +08:00
Pablo Galindo 70c188eee0
Add double quote cases to invalid prefix tests (GH-19489) 2020-04-13 02:47:35 +01:00
Victor Stinner da7933ecc3
bpo-40268: Add _PyInterpreterState_GetConfig() (GH-19492)
Don't access PyInterpreterState.config member directly anymore, but
use new functions:

* _PyInterpreterState_GetConfig()
* _PyInterpreterState_SetConfig()
* _Py_GetConfig()
2020-04-13 03:04:28 +02:00
Victor Stinner 14d5331eb5
bpo-40234: Revert "bpo-37266: Daemon threads are now denied in subinterpreters (GH-14049)" (GH-19456)
This reverts commit 066e5b1a91.
2020-04-12 23:45:09 +02:00