Commit Graph

10745 Commits

Author SHA1 Message Date
Yury Selivanov 2ec872b31e
bpo-34762: Fix contextvars C API to use PyObject* pointer types. (GH-9473) 2018-09-21 15:33:56 -04:00
Raymond Hettinger b46ad5431d
Minor performance tweak for deque.index() with a start argument (GH-9440) 2018-09-21 01:46:41 -07:00
Serhiy Storchaka fb3e9c00ed
bpo-34755: Add few minor optimizations in _asynciomodule.c. (GH-9455) 2018-09-21 09:11:32 +03:00
Zackery Spytz 91e6c8717b bpo-34735: Fix a memory leak in Modules/timemodule.c (GH-9418)
There was a missing PyMem_Free(format) in time_strftime().
2018-09-21 09:09:48 +03:00
Benjamin Peterson c510c6b8b6
Simplify PyInit_timezone. (GH-9467)
Reduce the knotty preprocessor conditional logic, dedent unnecessarily nested
code, and handle errors properly.

The first edition of this change (afde1c1a05)
failed (bpo-34715) because FreeBSD doesn't define the timezone globals. That's
why we're now checking for HAVE_DECL_TZNAME.
2018-09-20 19:52:18 -07:00
Benjamin Peterson a4ae828ee4
closes bpo-34656: Avoid relying on signed overflow in _pickle memos. (GH-9261) 2018-09-20 18:36:40 -07:00
Berker Peksag b10a64d117
bpo-34743: Fix test_database_source_name under SQLite 3.7.9 (GH-9426) 2018-09-20 14:14:33 +03:00
Berker Peksag 8d1e190fc5
bpo-32215: Fix performance regression in sqlite3 (GH-8511) 2018-09-20 14:10:49 +03:00
Victor Stinner 06e7608207
Revert "bpo-34589: Add -X coerce_c_locale command line option (GH-9378)" (GH-9430)
* Revert "bpo-34589: Add -X coerce_c_locale command line option (GH-9378)"

This reverts commit dbdee0073c.

* Revert "bpo-34589: C locale coercion off by default (GH-9073)"

This reverts commit 7a0791b699.

* Revert "bpo-34589: Make _PyCoreConfig.coerce_c_locale private (GH-9371)"

This reverts commit 188ebfa475.
2018-09-19 14:56:36 -07:00
Serhiy Storchaka 79d1c2e6c9
bpo-25711: Rewrite zipimport in pure Python. (GH-6809) 2018-09-18 22:22:29 +03:00
Christian Heimes cb5778f00c bpo-34623: Use XML_SetHashSalt in _elementtree (GH-9146)
The C accelerated _elementtree module now initializes hash randomization
salt from _Py_HashSecret instead of libexpat's default CPRNG.

Signed-off-by: Christian Heimes <christian@python.org>



https://bugs.python.org/issue34623
2018-09-18 05:38:58 -07:00
Serhiy Storchaka 0185f34ddc
bpo-33721: Make some os.path functions and pathlib.Path methods be tolerant to invalid paths. (#7695)
Such functions as os.path.exists(), os.path.lexists(), os.path.isdir(),
os.path.isfile(), os.path.islink(), and os.path.ismount() now return False
instead of raising ValueError or its subclasses UnicodeEncodeError
and UnicodeDecodeError for paths that contain characters or bytes
unrepresentative at the OS level.
2018-09-18 11:28:51 +03:00
Serhiy Storchaka 7bdf28265a
bpo-32455: Add jump parameter to dis.stack_effect(). (GH-6610)
Add C API function PyCompile_OpcodeStackEffectWithJump().
2018-09-18 09:54:26 +03:00
Victor Stinner 7a0791b699
bpo-34589: C locale coercion off by default (GH-9073)
Py_Initialize() and Py_Main() cannot enable the C locale coercion
(PEP 538) anymore: it is always disabled. It can now only be enabled
by the Python program ("python3).

test_embed: get_filesystem_encoding() doesn't have to set PYTHONUTF8
nor PYTHONCOERCECLOCALE, these variables are already set in the
parent.
2018-09-17 16:22:29 -07:00
Victor Stinner 188ebfa475
bpo-34589: Make _PyCoreConfig.coerce_c_locale private (GH-9371)
_PyCoreConfig:

* Rename coerce_c_locale to _coerce_c_locale
* Rename coerce_c_locale_warn to _coerce_c_locale_warn

These fields are now private (name prefixed by "_").
2018-09-17 15:13:17 -07:00
Victor Stinner 1fb399ba4e
bpo-34715: Revert "Simplify PyInit_timezone. (GH-9323)" (GH-9366)
This reverts commit afde1c1a05.
2018-09-17 13:56:17 -07:00
Steve Dower c6fd1c1c3a
bpo-32533: Fixed thread-safety of error handling in _ssl. (GH-7158) 2018-09-17 11:34:47 -07:00
Serhiy Storchaka 12a69db908
Convert os.readlink() to Argument Clinic. (GH-8778)
Also convert os.get_blocking() and os.set_blocking().
2018-09-17 15:38:27 +03:00
Alexandru Ardelean b3a271fc0c bpo-34710: fix SSL module build (GH-9347)
Include ``openssl/dh.h`` header file to fix implicit function declaration of ``DH_free()``.

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
2018-09-17 04:53:31 -07:00
Vladimir Matveev 7843caeb90 bpo-34603, ctypes/libffi_msvc: Fix returning structs from functions (GH-9258) 2018-09-15 22:36:29 -07:00
Benjamin Peterson afde1c1a05
Simplify PyInit_timezone. (GH-9323)
Assume tzname exists. Only use a hack to compute altzone if it's not defined.
2018-09-14 16:21:32 -07:00
Eric Snow 5903296045
bpo-34651: Only allow the main interpreter to fork. (gh-9279)
When os.fork() is called (on platforms that support it) all threads but the current one are destroyed in the child process. Consequently we must ensure that all but the associated interpreter are likewise destroyed. The main interpreter is critical for runtime operation, so we must ensure that fork only happens in the main interpreter.

https://bugs.python.org/issue34651
2018-09-14 14:17:20 -07:00
Benjamin Peterson b93062b7fb
bpo-34672: Don't pass NULL to gmtime_r. (GH-9312) 2018-09-14 10:39:13 -07:00
Benjamin Peterson 5633c4f342
bpo-34672: Try to pass the C library's own timezone strings back to it. (GH-9288) 2018-09-14 09:09:04 -07:00
Benjamin Peterson ea13740a37
bpo-34674: Assume unistd.h exists on Unix. (GH-9290) 2018-09-13 21:57:31 -07:00
Raymond Hettinger 1401018da1
Remove wording that could be deemed to be perjorative (GH-9287) 2018-09-13 21:17:40 -07:00
Gregory P. Smith a20b6adb5a bpo-34658: Fix rare subprocess prexec_fn fork error. (GH-9255)
[bpo-34658](https://www.bugs.python.org/issue34658): Fix a rare interpreter unhandled exception state SystemError only
seen when using subprocess with a preexec_fn while an after_parent handler has
been registered with os.register_at_fork and the fork system call fails.



https://bugs.python.org/issue34658
2018-09-13 04:30:10 -07:00
Alexey Izbyshev 6f82bffd2d bpo-34649: Add missing NULL checks to _encoded_const() (GH-9225)
Reported by Svace static analyzer.
2018-09-13 00:05:20 +03:00
Oren Milman 0bd1a2dcfd bpo-31577: Fix a crash in os.utime() in case of a bad ns argument. (GH-3752) 2018-09-12 22:14:35 +03:00
Benjamin Peterson e502451781
closes bpo-34646: Remove PyAPI_* macros from declarations. (GH-9218) 2018-09-12 12:06:42 -07:00
Sergey Fedoseev 7f0d59f3a8 Simplified implementation of _sre.ascii_iscased(). (GH-9097) 2018-09-12 15:49:09 +03:00
Cheryl Sabella 731ff68eee closes bpo-25041: Document AF_PACKET socket address format. (GH-4092) 2018-09-11 17:32:15 -07:00
Benjamin Peterson b9bf9d025e
Delete old expat comment. (GH-9197) 2018-09-11 17:17:39 -07:00
Max Bélanger 4859ba0d2c closes bpo-31903: Release the GIL when calling into SystemConfiguration (GH-4178) 2018-09-11 16:14:00 -07:00
Sergey Fedoseev ec014a101a bpo-34636: Use fast path for more chars in SRE category macros. (GH-9170)
When handling \s, \d, or \w (and their inverse) escapes in bytes regexes this a small but measurable performance improvement.

<!-- issue-number: [bpo-34636](https://www.bugs.python.org/issue34636) -->
https://bugs.python.org/issue34636
<!-- /issue-number -->
2018-09-11 15:47:59 -07:00
Tal Einat c4bccd3c76 bpo-20180: convert most of itertoolsmodule.c to use Argument Clinic (GH-9164) 2018-09-11 14:49:13 -07:00
Oren Milman 24bd50bdcc closes bpo-31608: Fix a crash in methods of a subclass of _collections.deque with a bad __new__(). (GH-3788) 2018-09-11 11:46:55 -07:00
Berker Peksag b690b9b047
bpo-29386: Pass -1 to epoll_wait() when timeout is < -1 (GH-9040)
Although the kernel accepts any negative value for timeout, the
documented value to block indefinitely is -1.

This commit also makes the code similar to select.poll.poll().
2018-09-11 20:29:48 +03:00
Andrew Svetlov 0baa72f4b2
bpo-34622: Extract asyncio exceptions into a separate module (GH-9141) 2018-09-11 10:13:04 -07:00
Oren Milman 735171e334 closes bpo-29832: Remove "getsockaddrarg" from error messages. (GH-3163) 2018-09-11 09:51:29 -07:00
Benjamin Peterson 5033aa77aa
bpo-34625: Update vendorized expat version to 2.2.6. (GH-9150) 2018-09-10 21:04:00 -07:00
Gregory P. Smith ce34410b8b
bpo-32270: Don't close stdin/out/err in pass_fds (GH-6242)
When subprocess.Popen() stdin= stdout= or stderr= handles are specified
and appear in pass_fds=, don't close the original fds after dup'ing them.

This implementation and unittest primarily came from @izbyshev (see the PR)

See also b89b52f284

This also removes the old manual p2cread, c2pwrite, and errwrite closing logic
as inheritable flags and _close_open_fds takes care of that properly today without special treatment.

This code is within child_exec() where it is the only thread so there is no
race condition between the dup and _Py_set_inheritable_async_safe call.
2018-09-10 17:46:22 -07:00
Tal Einat 3286ce4ade bpo-20180: itertools.groupby Argument Clinic conversion (GH-4170) 2018-09-10 11:33:08 -07:00
Peter Eisentraut 0e0bc4e221 Fix misleading mentions of tp_size in comments (GH-9093)
Many type object initializations labeled a field "tp_size" in the
comment, but the name of that field is tp_basicsize.
2018-09-10 09:46:08 -07:00
Serhiy Storchaka d700f97b62
bpo-20104: Change the file_actions parameter of os.posix_spawn(). (GH-6725)
* Make its default value an empty tuple instead of None.
* Make it a keyword-only parameter.
2018-09-08 14:48:18 +03:00
William Grzybowski 28658485a5 bpo-34604: Fix possible mojibake in pwd.getpwnam() and grp.getgrnam() (GH-9098)
Pass the user/group name as Unicode to the formatting function,
instead of always decoding a bytes string from UTF-8.
2018-09-07 19:10:39 +02:00
Pablo Galindo 254a4663d8
bpo-20104: Add flag capabilities to posix_spawn (GH-6693)
Implement the "attributes objects" parameter of `os.posix_spawn` to complete the implementation and fully cover the underlying API.
2018-09-07 16:44:24 +01:00
William Grzybowski 23e65b2555 bpo-33625: Release GIL for grp.getgr{nam,gid} and pwd.getpw{nam,uid} (GH-7081)
Release GIL on grp.getgrnam(), grp.getgrgid(), pwd.getpwnam() and
pwd.getpwuid() if reentrant variants of these functions are available.

Patch by William Grzybowski.
2018-09-07 14:06:15 +02:00
Sergey Fedoseev f9925d86c9 _sre.c: Removed unused SRE_IS_ALNUM macro (GH-9090) 2018-09-07 10:56:09 +02:00
Erik Janssens 874809ea38 closes bpo-34581 : Conditionalize use of __pragma in Modules/socketmodule.c. (GH-9067) 2018-09-04 23:29:42 -07:00