Commit 1a2f5264 authored by Matti Picus's avatar Matti Picus
Browse files

merge default into release

--HG--
branch : release-pypy2.7-v7.x
Pipeline #26815 passed with stage
in 5 minutes and 10 seconds
......@@ -19,7 +19,7 @@ three different interpreters:
backported security updates)
- PyPy3.7, which is an interpreter supporting the syntax and the features of
Python 3.7, including the stdlib for CPython 3.7.10.
Python 3.7, including the stdlib for CPython 3.7.12.
- PyPy3.8, which is an interpreter supporting the syntax and the features of
Python 3.8, including the stdlib for CPython 3.8.12. Since this is our
......@@ -208,6 +208,7 @@ Python 3.7+ speedups and enhancements
- Check env keys for ``'='`` when calling ``os.execve``
- Add ``_winapi.GetFileType`` and ``FILE_TYPE_*`` values (issue 3531_)
- Allow ``ctypes.POINTER()`` to cast `ctypes.array`` (issue 3546_)
- Update the stdlib to v3.7.12
Python 3.7 C-API
~~~~~~~~~~~~~~~~
......
......@@ -5,3 +5,8 @@ What's new in PyPy2.7 7.3.6+
.. this is a revision shortly after release-pypy-7.3.6
.. startrev: 000a308e967f
.. branch: win64-stat
Add ``st_file_attributes`` and ``st_reparse_tag`` attributes to ``os.stat``
on windows. Also follow the reparse logic of Python3.8.
......@@ -835,6 +835,22 @@ def _env2interp(space, w_env):
env[space.text0_w(w_key)] = space.text0_w(w_value)
return env
def _env2interp(space, w_env):
env = {}
w_keys = space.call_method(w_env, 'keys')
for w_key in space.unpackiterable(w_keys):
w_value = space.getitem(w_env, w_key)
key = space.text0_w(w_key)
val = space.text0_w(w_value)
# Search from index 1 because on Windows starting '=' is allowed for
# defining hidden environment variables
if len(key) == 0 or '=' in key[1:]:
raise oefmt(space.w_ValueError,
"illegal environment variable name")
env[key] = val
return env
@unwrap_spec(command='fsencode')
def execve(space, command, w_args, w_env):
""" execve(path, args, env)
......
This diff is collapsed.
......@@ -31,8 +31,15 @@ def GetCConfigGlobal():
'INVALID_FILE_ATTRIBUTES')
ERROR_SHARING_VIOLATION = platform.ConstantInteger(
'ERROR_SHARING_VIOLATION')
ERROR_ACCESS_DENIED = platform.ConstantInteger(
'ERROR_ACCESS_DENIED')
ERROR_ACCESS_DENIED = platform.ConstantInteger('ERROR_ACCESS_DENIED')
ERROR_CANT_ACCESS_FILE = platform.ConstantInteger(
'ERROR_CANT_ACCESS_FILE')
ERROR_INVALID_PARAMETER = platform.ConstantInteger(
'ERROR_INVALID_PARAMETER')
ERROR_NOT_SUPPORTED = platform.ConstantInteger(
'ERROR_NOT_SUPPORTED')
ERROR_INVALID_FUNCTION = platform.ConstantInteger(
'ERROR_INVALID_FUNCTION')
MOVEFILE_REPLACE_EXISTING = platform.ConstantInteger(
'MOVEFILE_REPLACE_EXISTING')
_S_IFDIR = platform.ConstantInteger('_S_IFDIR')
......@@ -50,17 +57,23 @@ def GetCConfigGlobal():
FILE_TYPE_UNKNOWN = platform.ConstantInteger('FILE_TYPE_UNKNOWN')
FILE_TYPE_CHAR = platform.ConstantInteger('FILE_TYPE_CHAR')
FILE_TYPE_PIPE = platform.ConstantInteger('FILE_TYPE_PIPE')
FILE_READ_ATTRIBUTES = platform.ConstantInteger(
'FILE_READ_ATTRIBUTES')
FILE_TYPE_DISK = platform.ConstantInteger('FILE_TYPE_DISK')
FILE_READ_ATTRIBUTES = platform.ConstantInteger('FILE_READ_ATTRIBUTES')
FILE_WRITE_ATTRIBUTES = platform.ConstantInteger(
'FILE_WRITE_ATTRIBUTES')
OPEN_EXISTING = platform.ConstantInteger(
'OPEN_EXISTING')
GENERIC_READ = platform.ConstantInteger('GENERIC_READ')
FILE_SHARE_READ = platform.ConstantInteger('FILE_SHARE_READ')
FILE_SHARE_WRITE = platform.ConstantInteger('FILE_SHARE_WRITE')
OPEN_EXISTING = platform.ConstantInteger('OPEN_EXISTING')
FILE_ATTRIBUTE_NORMAL = platform.ConstantInteger(
'FILE_ATTRIBUTE_NORMAL')
FILE_FLAG_BACKUP_SEMANTICS = platform.ConstantInteger(
'FILE_FLAG_BACKUP_SEMANTICS')
FILE_FLAG_OPEN_REPARSE_POINT = platform.ConstantInteger(
'FILE_FLAG_OPEN_REPARSE_POINT')
FILE_ATTRIBUTE_REPARSE_POINT = platform.ConstantInteger(
'FILE_ATTRIBUTE_REPARSE_POINT')
FileAttributeTagInfo = platform.ConstantInteger('FileAttributeTagInfo')
VOLUME_NAME_DOS = platform.ConstantInteger('VOLUME_NAME_DOS')
VOLUME_NAME_NT = platform.ConstantInteger('VOLUME_NAME_NT')
......@@ -86,6 +99,11 @@ def GetCConfigGlobal():
('nFileIndexHigh', rwin32.DWORD),
('nFileIndexLow', rwin32.DWORD)])
FILE_ATTRIBUTE_TAG_INFO = platform.Struct(
'FILE_ATTRIBUTE_TAG_INFO',
[('FileAttributes', rwin32.DWORD),
('ReparseTag', rwin32.DWORD)])
return CConfigGlobal
config_global = None
......@@ -109,11 +127,13 @@ def make_win32_traits(traits):
'struct _WIN32_FIND_DATA' + suffix,
# Only interesting fields
[('dwFileAttributes', rwin32.DWORD),
('nFileSizeHigh', rwin32.DWORD),
('nFileSizeLow', rwin32.DWORD),
('ftCreationTime', rwin32.FILETIME),
('ftLastAccessTime', rwin32.FILETIME),
('ftLastWriteTime', rwin32.FILETIME),
('nFileSizeHigh', rwin32.DWORD),
('nFileSizeLow', rwin32.DWORD),
('dwReserved0', rwin32.DWORD),
('dwReserved1', rwin32.DWORD),
('cFileName', lltype.FixedSizeArray(traits.CHAR, 250))])
if config_global is None:
......@@ -129,18 +149,25 @@ def make_win32_traits(traits):
class Win32Traits:
apisuffix = suffix
for name in '''WIN32_FIND_DATA WIN32_FILE_ATTRIBUTE_DATA BY_HANDLE_FILE_INFORMATION
for name in '''WIN32_FIND_DATA WIN32_FILE_ATTRIBUTE_DATA
BY_HANDLE_FILE_INFORMATION
FILE_ATTRIBUTE_TAG_INFO
GetFileExInfoStandard
FILE_ATTRIBUTE_DIRECTORY FILE_ATTRIBUTE_READONLY
INVALID_FILE_ATTRIBUTES
_S_IFDIR _S_IFREG _S_IFCHR _S_IFIFO
FILE_TYPE_UNKNOWN FILE_TYPE_CHAR FILE_TYPE_PIPE
ERROR_INVALID_PARAMETER FILE_TYPE_DISK GENERIC_READ
FILE_SHARE_READ FILE_SHARE_WRITE ERROR_NOT_SUPPORTED
FILE_FLAG_OPEN_REPARSE_POINT FileAttributeTagInfo
FILE_READ_ATTRIBUTES FILE_ATTRIBUTE_NORMAL
FILE_WRITE_ATTRIBUTES OPEN_EXISTING FILE_FLAG_BACKUP_SEMANTICS
FILE_WRITE_ATTRIBUTES OPEN_EXISTING
VOLUME_NAME_DOS VOLUME_NAME_NT
ERROR_FILE_NOT_FOUND ERROR_NO_MORE_FILES
ERROR_SHARING_VIOLATION MOVEFILE_REPLACE_EXISTING
ERROR_ACCESS_DENIED
ERROR_ACCESS_DENIED ERROR_CANT_ACCESS_FILE
ERROR_INVALID_FUNCTION FILE_FLAG_BACKUP_SEMANTICS
FILE_ATTRIBUTE_REPARSE_POINT
_O_RDONLY _O_WRONLY _O_BINARY
'''.split():
locals()[name] = config[name]
......@@ -178,6 +205,12 @@ def make_win32_traits(traits):
rwin32.BOOL,
save_err=rffi.RFFI_SAVE_LASTERROR)
GetFileInformationByHandleEx = external(
'GetFileInformationByHandleEx',
[rwin32.HANDLE, rffi.INT, rffi.VOIDP, rwin32.DWORD],
rwin32.BOOL,
save_err=rffi.RFFI_SAVE_LASTERROR)
GetFileInformationByHandle = external(
'GetFileInformationByHandle',
[rwin32.HANDLE, lltype.Ptr(BY_HANDLE_FILE_INFORMATION)],
......@@ -249,6 +282,8 @@ def make_win32_traits(traits):
rwin32.BOOL,
save_err=rffi.RFFI_SAVE_LASTERROR)
TagInfoSize = 2 * rffi.sizeof(rwin32.DWORD)
return Win32Traits
def make_longlong(high, low):
......
......@@ -77,10 +77,11 @@ class TestPosixStatFunctions:
assert st.st_dev == st.st_ino == 0
st = rposix_stat.stat3('C:\\')
assert st.st_dev != 0 and st.st_ino != 0
assert st.st_file_attributes & 0x16 # FILE_ATTRIBUTE_DIRECTORY
assert st.st_reparse_tag == 0
st2 = rposix_stat.lstat3('C:\\')
assert (st2.st_dev, st2.st_ino) == (st.st_dev, st.st_ino)
@py.test.mark.skipif("not hasattr(rposix_stat, 'fstatat')")
def test_fstatat(tmpdir):
tmpdir.join('file').write('text')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment