Serhiy Storchaka
1180e5a518
bpo-30879: os.listdir() and os.scandir() now emit bytes names when ( #2634 )
...
called with bytes-like argument.
2017-07-11 06:36:46 +03:00
Serhiy Storchaka
f7eae0adfc
[security] bpo-13617: Reject embedded null characters in wchar* strings. ( #2302 )
...
Based on patch by Victor Stinner.
Add private C API function _PyUnicode_AsUnicode() which is similar to
PyUnicode_AsUnicode(), but checks for null characters.
2017-06-28 08:30:06 +03:00
Eric N. Vander Weele
a7874c73c0
bpo-30769: Fix reference leak introduced in 77703942c5
( #2416 )
...
New error condition paths were introduced, which did not decrement
`key2` and `val2` objects. Therefore, decrement references before
jumping to the error label.
Signed-off-by: Eric N. Vander Weele <ericvw@gmail.com>
2017-06-27 03:35:20 +02:00
Serhiy Storchaka
77703942c5
bpo-30746: Prohibited the '=' character in environment variable names ( #2382 )
...
in `os.putenv()` and `os.spawn*()`.
2017-06-25 07:33:01 +03:00
Victor Stinner
c8d6ab2e25
bpo-30602: Fix lastarg in os.spawnve() ( #2287 )
...
Fix a regression introduced by myself in the commit
526b22657c
.
2017-06-23 15:04:46 +02:00
Victor Stinner
8acb4cf2b3
bpo-30602: Fix refleak in os.spawnv() ( #2212 )
...
When os.spawnv() fails while handling arguments, free correctly
argvlist: pass lastarg+1 rather than lastarg to free_string_array()
to also free the first item.
2017-06-15 15:30:40 +02:00
Victor Stinner
526b22657c
bpo-30602: Fix refleak in os.spawnve() ( #2184 )
...
When os.spawnve() fails while handling arguments, free correctly
argvlist: pass lastarg+1 rather than lastarg to free_string_array()
to also free the first item.
2017-06-14 14:26:21 +02:00
messi Liao
0d322181d9
bpo-30650: Fixed a syntax error: missed right parentheses ( #2154 )
2017-06-13 17:30:43 +03:00
Gregory P. Smith
163468a766
bpo-16500: Don't use string constants for os.register_at_fork() behavior ( #1834 )
...
Instead use keyword only arguments to os.register_at_fork for each of the scenarios.
Updates the documentation for clarity.
2017-05-29 10:03:41 -07:00
Antoine Pitrou
346cbd351e
bpo-16500: Allow registering at-fork handlers ( #1715 )
...
* bpo-16500: Allow registering at-fork handlers
* Address Serhiy's comments
* Add doc for new C API
* Add doc for new Python-facing function
* Add NEWS entry + doc nit
2017-05-27 17:50:54 +02:00
xdegaye
50e86033de
bpo-29619: Do not use HAVE_LARGEFILE_SUPPORT for type conversions (GH-1666).
...
bpo-29619: Do not use HAVE_LARGEFILE_SUPPORT for type conversions (GH-1666).
* Use only the LongLong form for the conversions.
2017-05-22 11:15:08 +02:00
Serhiy Storchaka
bf623ae884
bpo-30061: Check if PyObject_Size()/PySequence_Size()/PyMapping_Size() ( #1096 )
...
raised an error.
Replace them with using concrete types API that never fails if appropriate.
2017-04-19 20:03:52 +03:00
Serhiy Storchaka
ea720fe7e9
bpo-25996: Added support of file descriptors in os.scandir() on Unix. ( #502 )
...
os.fwalk() is sped up by 2 times by using os.scandir().
2017-03-30 09:12:31 +03:00
Victor Stinner
0f6d73343d
bpo-29619: Convert st_ino using unsigned integer ( #557 )
...
bpo-29619: os.stat() and os.DirEntry.inodeo() now convert inode
(st_ino) using unsigned integers.
2017-03-09 17:34:28 +01:00
Yen Chi Hsuan
72e81d00ee
bpo-29556: Remove unused #include <langinfo.h> ( #98 )
...
bltinmodule.c: Added in b744ba1
and no longer necessary since d64e8a7
posixmodule.c: Added in d1cd4d4
and no longer necessary since efb00c0
pythonrun.c: Added in 73d538b
and no longer necessary since d600951
sysmodule.c: Added in 5467d4c
and no longer necessary since a2c17c5
2017-02-16 00:34:30 +01:00
Serhiy Storchaka
095ef73492
Issue #29513 : Fix outdated comment and remove redundand code is os.scandir().
2017-02-09 20:05:51 +02:00
Serhiy Storchaka
228b12edcc
Issue #28999 : Use Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE wherever
...
possible. Patch is writen with Coccinelle.
2017-01-23 09:47:21 +02:00
Xiang Zhang
1dfaa6c38a
Issue #29092 : Merge 3.6.
2017-01-22 13:10:12 +08:00
Xiang Zhang
4459e009ed
Issue #29092 : Sync os.stat's doc and docstring on path type.
2017-01-22 13:04:17 +08:00
Xiang Zhang
ce16c6827c
Issue #29034 : Merge 3.6.
2017-01-08 23:30:05 +08:00
Xiang Zhang
04316c4cc8
Issue #29034 : Fix memory leak and use-after-free in path_converter.
2017-01-08 23:26:57 +08:00
Victor Stinner
f17c3de263
Use _PyObject_CallNoArg()
...
Replace:
PyObject_CallFunctionObjArgs(callable, NULL)
with:
_PyObject_CallNoArg(callable)
2016-12-06 18:46:19 +01:00
Victor Stinner
9a2329f9e1
Issue #28152 : Fix -Wunreachable-code warnings on Clang
...
Don't declare dead code when the code is declared with Clang.
2016-12-05 17:56:36 +01:00
Victor Stinner
de4ae3d486
Backed out changeset b9c9691c72c5
...
Issue #28858 : The change b9c9691c72c5 introduced a regression. It seems like
_PyObject_CallArg1() uses more stack memory than
PyObject_CallFunctionObjArgs().
2016-12-04 22:59:09 +01:00
Victor Stinner
27580c1fb5
Replace PyObject_CallFunctionObjArgs() with fastcall
...
* PyObject_CallFunctionObjArgs(func, NULL) => _PyObject_CallNoArg(func)
* PyObject_CallFunctionObjArgs(func, arg, NULL) => _PyObject_CallArg1(func, arg)
PyObject_CallFunctionObjArgs() allocates 40 bytes on the C stack and requires
extra work to "parse" C arguments to build a C array of PyObject*.
_PyObject_CallNoArg() and _PyObject_CallArg1() are simpler and don't allocate
memory on the C stack.
This change is part of the fastcall project. The change on listsort() is
related to the issue #23507 .
2016-12-01 14:43:22 +01:00
Serhiy Storchaka
a98c4a984b
Replaced outdated macros _PyUnicode_AsString and _PyUnicode_AsStringAndSize
...
with PyUnicode_AsUTF8 and PyUnicode_AsUTF8AndSize.
2016-11-20 09:13:40 +02:00
Serhiy Storchaka
06515833fe
Replaced outdated macros _PyUnicode_AsString and _PyUnicode_AsStringAndSize
...
with PyUnicode_AsUTF8 and PyUnicode_AsUTF8AndSize.
2016-11-20 09:13:07 +02:00
Steve Dower
83aeb3cc80
Issue #28732 : Raise ValueError when argv[0] is empty
2016-11-19 19:17:46 -08:00
Steve Dower
bce26262d1
Issue #28732 : Raise ValueError when argv[0] is empty
2016-11-19 19:17:26 -08:00
Steve Dower
93ff8725b3
Issue #28732 : Raise ValueError when argv[0] is empty.
2016-11-19 19:03:54 -08:00
Steve Dower
6f33e294e5
Issue #28732 : Raise ValueError when os.spawn*() is passed an empty tuple of arguments
2016-11-19 18:53:36 -08:00
Steve Dower
859fd7bd7a
Issue #28732 : Raise ValueError when os.spawn*() is passed an empty tuple of arguments
2016-11-19 18:53:19 -08:00
Steve Dower
1325ee0938
Merge from 3.6
2016-11-19 18:41:31 -08:00
Steve Dower
c3630612ab
Merge from 3.5 and fix a few other functions missing IPH handling.
2016-11-19 18:41:16 -08:00
Steve Dower
11f4326ca1
Issue #28732 : Fix crash in os.spawnv() with no elements in args
...
Prevents crashes in some other posixmodule.c functions
2016-11-19 18:33:39 -08:00
Serhiy Storchaka
b74fecc396
Issue #28585 : Restored docstring of os._isdir().
2016-11-08 20:28:43 +02:00
Serhiy Storchaka
852cc3335e
Issue #28585 : Restored docstring of os._isdir().
2016-11-08 20:26:18 +02:00
Serhiy Storchaka
579f038018
Issue #28585 : Restored docstring of os._isdir().
2016-11-08 20:21:22 +02:00
Serhiy Storchaka
49d02d1659
Issue #28586 : Converted os.scandir() to Argument Clinic.
2016-11-06 13:45:33 +02:00
Martin Panter
b1321fba53
Issue #28394 : More typo fixes for 3.6+
2016-10-10 00:38:21 +00:00
Serhiy Storchaka
2674bc7229
Issue #27998 : Fixed bytes path support in os.scandir() on Windows.
...
Patch by Eryk Sun.
2016-10-08 20:16:57 +03:00
Christian Heimes
6f3f3e5ca4
Increase buffer for readlink() in case OS will support longer names one day.
2016-09-23 20:24:39 +02:00
Christian Heimes
3cb091e576
Increase buffer for readlink() in case OS will support longer names one day.
2016-09-23 20:24:28 +02:00
Victor Stinner
ec2319c46d
Fix memleak in os.getrandom()
...
Issue #27778 : Fix a memory leak in os.getrandom() when the getrandom() is
interrupted by a signal and a signal handler raises a Python exception.
Modify also os_getrandom_impl() to avoid the temporary buffer, use directly a
Python bytes object.
2016-09-20 23:00:59 +02:00
Victor Stinner
26c03bd7d5
Fix memory leak in path_converter()
...
Issue #28200 : Replace PyUnicode_AsWideCharString() with
PyUnicode_AsUnicodeAndSize().
2016-09-19 11:55:44 +02:00
Berker Peksag
bf3c1c3235
Issue #28075 : Fix test_access_denied in Python 3.5
...
I forgot there two variations of os.stat() in Python 3.5.
2016-09-18 13:56:29 +03:00
Berker Peksag
052e4f18c4
Issue #28075 : Merge from 3.5
2016-09-17 15:51:14 +03:00
Berker Peksag
0b4dc4846b
Issue #28075 : Check for ERROR_ACCESS_DENIED in Windows implementation of os.stat()
...
Patch by Eryk Sun.
2016-09-17 15:49:59 +03:00
Berker Peksag
3940499ca8
Issue #28156 : Export os.getpid() conditionally
...
Patch by Ed Schouten.
2016-09-15 20:45:16 +03:00
Berker Peksag
8181646931
Issue #28114 : Fix a crash in parse_envlist() when env contains byte strings
...
Patch by Eryk Sun.
2016-09-15 20:19:47 +03:00