Commit Graph

1011 Commits

Author SHA1 Message Date
Giuseppe Scrivano 96a5e50a5d bpo-32143: add f_fsid to os.statvfs() (#4571)
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2017-12-14 17:46:46 -05:00
Anthony Sottile 233ef249cc bpo-32277: Fix exception raised from chmod(..., follow_symlinks=False) (#4797) 2017-12-14 18:57:55 +02:00
Erik Bray 03eb11f0b3 bpo-16135: Cleanup: Code rot left over from OS/2 support (GH-4147)
Remove dangling references to PYCC_VACPP that are not relelvant
since removal of OS/2 support.
2017-10-27 05:27:06 -07:00
Victor Stinner 850a18e03e bpo-30768: Recompute timeout on interrupted lock (GH-4103)
Fix the pthread+semaphore implementation of
PyThread_acquire_lock_timed() when called with timeout > 0 and
intr_flag=0: recompute the timeout if sem_timedwait() is interrupted
by a signal (EINTR).

See also the PEP 475.

The pthread implementation of PyThread_acquire_lock() now fails with
a fatal error if the timeout is larger than PY_TIMEOUT_MAX, as done
in the Windows implementation.

The check prevents any risk of overflow in PyThread_acquire_lock().

Add also PY_DWORD_MAX constant.
2017-10-24 16:53:32 -07:00
Victor Stinner 01b5aab7bf bpo-31827: Remove os.stat_float_times() (GH-4061) 2017-10-24 02:02:00 -07:00
Victor Stinner a99121526a os.startfile(): add a C comment on security (#3877)
LoadLibrary("SHELL32") is not vulnerable to DLL hijacking.
2017-10-13 13:46:57 -07:00
Masayuki Yamamoto 731e189014 bpo-25658: Implement PEP 539 for Thread Specific Storage (TSS) API (GH-1362)
See PEP 539 for details.

Highlights of changes:

- Add Thread Specific Storage (TSS) API
- Document the Thread Local Storage (TLS) API as deprecated
- Update code that used TLS API to use TSS API
2017-10-06 20:41:34 +10:00
Benjamin Peterson 288d1daada remove support for BSD/OS (closes bpo-31624) (#3812) 2017-09-28 22:44:27 -07:00
Antoine Pitrou a6a4dc816d bpo-31370: Remove support for threads-less builds (#3385)
* Remove Setup.config
* Always define WITH_THREAD for compatibility.
2017-09-07 18:56:24 +02:00
Christian Heimes 75b961869a bpo-31343: Include sys/sysmacros.h (#3318)
Include sys/sysmacros.h for major(), minor(), and makedev(). GNU C libray
plans to remove the functions from sys/types.h.

Signed-off-by: Christian Heimes <christian@python.org>
2017-09-05 15:53:09 +02:00
Christopher Wilcox c67bae0478 bpo-30581: Windows: os.cpu_count() returns wrong number of processors (#2934)
* Fixes #30581 by adding a path to use newer GetMaximumProcessorCount API on Windows calls to os.cpu_count()

* Add NEWS.d entry for bpo-30581, os.cpu_count on Windows.

* Tweak NEWS entry
2017-08-30 11:01:08 +02:00
Коренберг Марк d4b93e21c2 bpo-31106: Fix handling of erros in posix_fallocate() and posix_fadvise() (#3000) (#3000) 2017-08-14 06:55:16 -07:00
Ville Skyttä 49b2734bf1 Spelling fixes (#2902) 2017-08-03 09:00:59 +03:00
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