Changes by Eryk Sun :
--
nosy: +pitrou
versions: +Python 3.6
___
Python tracker
<http://bugs.python.org/issue25803>
___
___
Python-bugs-list mailing list
Unsub
Eryk Sun added the comment:
test_CTRL_C_EVENT can be removed from Lib/test/test_os.py. It's of no practical
consequence. Ctrl+Break is always enabled in the child process, so
test_CTRL_BREAK_EVENT should remain.
When using CREATE_NEW_PROCESS_GROUP, the child process is started with C
Changes by Eryk Sun :
--
resolution: -> duplicate
stage: -> resolved
status: open -> closed
superseder: -> subprocess failing in GUI applications on Windows
___
Python tracker
<http://bugs.python
Changes by Eryk Sun :
--
resolution: -> duplicate
stage: -> resolved
status: open -> closed
superseder: -> subprocess failing in GUI applications on Windows
___
Python tracker
<http://bugs.python
Eryk Sun added the comment:
Using the cmd shell's "echo" command requires shell=True. You must have an
"echo.exe" somewhere in your PATH. Check "where echo" in cmd.
--
nosy: +eryksun
___
Python tracker
Eryk Sun added the comment:
AFAICT, there's no place where subprocess.Popen would be responsible for
removing braces from the output. I think it's something unusual with the
"echo.exe" program. In the cmd.exe shell -- i.e. no msys, bash, etc -- what do
you get for the foll
Eryk Sun added the comment:
Issue 24508 backported the project files from 3.5 to 2.7. In the new
pyproject.props, MS_DLL_ID (for the DLL string table) is defined as the value
of SysWinVer. Currently the latter is defined in python.props as follows:
$(MajorVersionNumber
Eryk Sun added the comment:
The signal module switched to using an enum for signal values:
>>> print(*map(repr, sorted(signal.Signals)), sep='\n')
We can use the console API when passed the CTRL_C_EVENT or CTRL_BREAK_EVE
Eryk Sun added the comment:
It's the correct behavior. 3.5 supports all versions of Windows that had
mainstream or extended support as of its release on 2015-09-13. Windows Server
2003 R2 extended support ended on 2015-07-14 [1].
[1]:
https://support.microsoft.com/en-us/lifecycle/search
Eryk Sun added the comment:
The ANSI API is problematic because it returns a best-fit encoding to the
system codepage. For example:
>>> os.listdir('.')
['ƠƨưƸǀLjǐǘǠǨǰǸ']
>>> os.listdir(b'.')
[b'O?u?|?iu?Kj?']
To so
Eryk Sun added the comment:
> To extend support for this to Windows, we can add a
> feature to mkstmp to not use O_TEMPORARY
O_TEMPORARY is only used for NamedTemporaryFile, not mkstemp.
Regarding NamedTemporaryFile, that can be worked around to keep Windows from
deleting the file
Eryk Sun added the comment:
Марк, os.open added dir_fd support in 3.3, which is implemented on POSIX
systems by calling openat. The dir_fd parameter is available for many os
functions. This is discussed in section 1.5, Files and Directories [1].
It would be nice if we could support dir_fd on
Eryk Sun added the comment:
This is due to using argument clinic in Modules/posixmodule.c:
/*[clinic input]
os.remove = os.unlink
builtin_function_or_method instances are equal if m_self (the module in this
case) and m_ml->ml_meth (the C function) are the same. In 3.4, the funct
Eryk Sun added the comment:
Starting a Windows process is expensive. Who not use threading, e.g.
SocketServer.ThreadingTCPServer?
It seems to me that it's a bug to even define ForkingMixIn, ForkingTCPServer,
and ForkingUDPServer on Windows. Those should be conditionally defined
dependi
Eryk Sun added the comment:
Considering there's no plan to implement bytes paths for scandir on Windows,
then the following line in the os docs needs to be modified: "All functions
accepting path or file names accept both bytes and string objects, and result
in an object of the sam
Eryk Sun added the comment:
psexec.exe can be run from the the live server.
>>> subprocess.call(r'\\live.sysinternals.com\tools\psexec.exe -s whoami')
PsExec v2.11 - Execute processes remotely
Copyright (C) 2001-2014 Mark Russinovich
Sysinternals - www.sysint
Eryk Sun added the comment:
The main log file reports that installing the CRT exited with the code
ERROR_INSTALL_ALREADY_RUNNING (0x652):
Another installation is already in progress.
Complete that installation before proceeding
with this install.
You may need to completely
Eryk Sun added the comment:
Packages are installed from the ProgramData folder on the system volume. For
example, the log shows the CRT update executed as follows:
"C:\Windows\system32\wusa.exe" "C:\ProgramData\Package Cache\
D4036846864773E3D647F421DFE7F6CA536E307B\
Eryk Sun added the comment:
Testing based on integrity level doesn't require creating a child process. I'm
attaching a ctypes-based example that defines a context manager that
temporarily sets the integrity level of the current thread's impersonation
token.
To get the imperso
Eryk Sun added the comment:
For anyone interested, this issue is solvable on Windows by working around how
O_TEMPORARY is implemented. To do this the _winapi module would need a wrapper
for SetFileInformationByHandle (available in Vista+), which would need to
support at least
Eryk Sun added the comment:
The current test works for 3.x because we keep the full string length via
PyUnicode_AsWideCharString(value, &len) when creating a REG_SZ value. OTOH, 2.x
Py2Reg gets the length via strlen. I'd prefer to make this consistent with 3.x
by using the full stri
Changes by Eryk Sun :
Added file: http://bugs.python.org/file41470/issue25778_py36_2.patch
___
Python tracker
<http://bugs.python.org/issue25778>
___
___
Python-bug
Changes by Eryk Sun :
Added file: http://bugs.python.org/file41469/issue25778_py27_1.patch
___
Python tracker
<http://bugs.python.org/issue25778>
___
___
Python-bug
Eryk Sun added the comment:
I've added a patch for 2.7 that updates Py2Reg to use PyString_GET_SIZE instead
of strlen and updates Reg2Py to use strnlen instead of returning strings with
embedded NULs.
--
___
Python tracker
<http://bugs.py
Eryk Sun added the comment:
bin() returns a Python literal, which thankfully requires an explicit sign. 2's
complement literals would be prone to human error. If you want 2's complement,
you can write your own function. For example:
def mybin(number, nbits=None, *, s
Eryk Sun added the comment:
You can build NumPy with only a C compiler, but it won't have accelerated
BLAS/LAPACK. However, lifetimes requires SciPy, which in turn requires Fortran.
This is a common requirement with a lot of the scientific-computing stack, so
you may as well choose a com
Eryk Sun added the comment:
PyLocale_setlocale in Modules/_localemodule.c is incorrectly passing the locale
as a UTF-8 string ("z") instead of using the codepage of the current locale.
As you can see below "å" is passed as the UTF-8 string "\xc3\xa5":
>&g
Eryk Sun added the comment:
Yes, it's ANSI. I should have said "system locale" instead of "current locale".
To find the requested locale, the CRT function __get_qualified_locale calls
EnumSystemLocalesA. The passed callback calls GetLocaleInfoA for each
enumerated
Eryk Sun added the comment:
The issue isn't quite the same for 3.5+. The new CRT uses Windows Vista locale
APIs. In this case it uses LOCALE_SENGLISHLANGUAGENAME instead of the old
LOCALE_SENGLANGUAGE. This maps "Norwegian" to simply "Norwegian" inst
Eryk Sun added the comment:
I didn't want to change the function in lieu of breaking someone's code. If
this change is accepted, then it at least needs a documentation note to
indicate the new behavior.
--
versions: +Python 3.6 -
Changes by Eryk Sun :
--
components: +Documentation, Library (Lib)
___
Python tracker
<http://bugs.python.org/issue24823>
___
___
Python-bugs-list mailin
Eryk Sun added the comment:
0xC409 (3221226505) is STATUS_STACK_BUFFER_OVERRUN due to the CRT calling
__fastfail(FAST_FAIL_FATAL_APP_EXIT) in abort(). This is expected behavior in
Windows 8+ [1].
Initially I couldn't reproduce this error because Python found the standard
library fro
Eryk Sun added the comment:
I would call SetDllDirectory instead of changing the current directory. This
replaces the current directory in the DLL search. Then call
SetDllDirectory(NULL) to restore the default before returning.
When you say "the CRT assembly", you'r
Eryk Sun added the comment:
> We'd have to statically link python##.dll.
I was talking about the partially static build that you used for
wininst-14.0-amd64.exe in rc3, in which vcruntime is linked statically but ucrt
is linked dynamically (actually to the api-ms-win-crt-* API sets)
Eryk Sun added the comment:
Steve, I think I understand the linking problem now -- in terms of the bad
assumption I mentioned in the previous message. Mark said the "built binary
links against the DLL version of the CRT", but I just checked in 3.5.1 that you
actually didn't swi
Eryk Sun added the comment:
> why isn't the directory containing the loaded DLL searched
> for dependencies?
That's possible. The loader provides several ways to go about solving this
problem. The directory of the DLL can be added to the search path if you use
LoadLibrary
Changes by Eryk Sun :
--
resolution: -> duplicate
stage: -> resolved
status: open -> closed
superseder: -> Let launcher autoselect best 32-bit Python on 64-bit system
___
Python tracker
<http://bugs.python
Changes by Eryk Sun :
--
components: +Windows
nosy: +paul.moore, steve.dower, tim.golden, zach.ware
versions: +Python 3.6
___
Python tracker
<http://bugs.python.org/issue25
Eryk Sun added the comment:
> I strongly recommend people use https://pypi.python.org/pypi/subprocess32/
I think this warrants a note that draws more attention to itself than the "see
also" text.
--
nosy: +eryksun
___
Python t
Changes by Eryk Sun :
--
components: +Windows
nosy: +paul.moore, steve.dower, tim.golden, zach.ware
___
Python tracker
<http://bugs.python.org/issue26086>
___
___
Eryk Sun added the comment:
The "yield from" syntax was added in Python 3.3, so somehow you're using the
3.5 standard library with either an old 3.x or 2.x version. The older version
shouldn't use 3.5's standard library, unless you have either PYTHONHOME or
PYTH
Eryk Sun added the comment:
Probably this is related to issue 25824. When built as a console application
and run from the command prompt, you should see an the error
ImportError: No module named site
If that's the case, the problem is that even the 64-bit build is incorrectly
settin
Eryk Sun added the comment:
If you own the only reference you can also delete the reference, which
deallocates the iterator and closes the handle.
Can you provide concrete examples where os.remove and os.chmod fail? At least
in Windows 7 and 10 the directory handle is opened with the normal
Eryk Sun added the comment:
> That behavior on Windows is quite counterintuitive.
It's counter-intuitive from a POSIX point of view, in which anonymous files are
allowed. In contrast, Windows allows any existing reference to unset the delete
disposition, so the name cannot be unlink
Eryk Sun added the comment:
Steve, is this something that can only be reproduced on Windows 7/2008 for some
reason? My "just for me" installation on Windows 10 seems to work fine. I
installed from "python-2.7.11.amd64.msi" with the MD5 sum
25acca42662d4b02682eee0df3f3446
Eryk Sun added the comment:
> Bad feature, as it is a violation of POLA.
I would be astonished if the default __str__ conversion returned a Latin-1
decoding, which won't fail, or used the locale encoding or UTF-8, which could
fail. The more explicit call x.decode() uses UTF-8 as the
Eryk Sun added the comment:
Serhiy, why doesn't truncate do a seek(0, SEEK_CUR) to synchronize the buffer's
file pointer before calling its truncate method? This also affects writing in
"+" modes when the two file pointers are out of sync.
-
Eryk Sun added the comment:
FYI, you can parse the cookie using struct or ctypes. For example:
class Cookie(ctypes.Structure):
_fields_ = (('start_pos', ctypes.c_longlong),
('dec_flags', ctypes.c_int),
('byt
Eryk Sun added the comment:
It's no surprise to see a memory error at 845 threads if you're using 32-bit
Python, which is limited to 2 GiB of address space. python.exe is built with a
default stack reservation of 200 bytes, so 845 threads reserve a total of
about 1.58 GiB. Con
Changes by Eryk Sun :
--
resolution: not a bug -> duplicate
superseder: -> 32-bit 2.7.11 installer creates registry keys that are
incompatible with the installed python27.dll
___
Python tracker
<http://bugs.python.org/i
Changes by Eryk Sun :
--
stage: -> resolved
___
Python tracker
<http://bugs.python.org/issue26108>
___
___
Python-bugs-list mailing list
Unsubscrib
Eryk Sun added the comment:
Try forcing cmd to wait using the "start" command:
C:\>start /b /w python -c "raise SystemExit(42)"
C:\>echo %errorlevel%
42
--
nosy: +eryksun
___
Python tracker
<http
Eryk Sun added the comment:
That the wait failed to get the 42 exit code means that the "python" command
(which may not actually be python.exe) is spawning a child process to run the
command and not waiting for it to exit. Please try the following using the
absolute path to python.e
Eryk Sun added the comment:
By shortcut I'm guessing you mean a batch file. A regular .LNK shortcut works
fine if .LNK is in PATHEXT. I sometimes use a shortcut when I need to set the
default to "Run as administrator". (I add a "runas" verb to the ProgIds to add
th
Eryk Sun added the comment:
> An .lnk is launched with ShellExecute which returns control
> immediately upon successful launch
cmd calls ShellExecuteEx, not ShellExecute, and it uses the flags
SEE_MASK_NO_CONSOLE (0x8000, don't create a new console) and
SEE_MASK_NOCLOSEPROCESS (0x0
Eryk Sun added the comment:
The class example defines "i" as a local variable, which means the CPython
operation used for unoptimized code (class or module/exec) is LOAD_NAME, which
searches locals, globals, and builtins. The result differs from the exec
example because a class i
Eryk Sun added the comment:
The patch is missing the "errors" parameter of PyUnicode_DecodeLocale. But it
should call PyUnicode_DecodeMBCS instead. In the "C" locale,
PyUnicode_DecodeLocale is Latin-1 because the CRT mbstowcs just casts the
values to wchar_t.
socket_getn
Eryk Sun added the comment:
Ensure that the .lnk target is the expected path to python.exe:
C:\Temp>py -3 -c ^
More? "from win32com import client^
More?
More? lnk = client.Dispatch('WScript.Shell').^
More? CreateShortCut('python.lnk')^
More?
Eryk Sun added the comment:
> A test with a 100 million random and selected IEEE 64-bit values
> returned no differences
The float type's tp_str and tp_repr both call float_repr in
Objects/floatobject.c. See the 3.5.1 PyFloat_Type definition [1].
Perhaps you were reading s
Eryk Sun added the comment:
You can't reassign the array object's __class__, and you can't modify the array
type itself, so I think modifying the internal b_length field of the object is
a confused result.
Even if you ignore this confusion, it's still not as simple a
Changes by Eryk Sun :
--
resolution: -> not a bug
stage: patch review -> resolved
___
Python tracker
<http://bugs.python.org/issue21328>
___
___
Pyth
Eryk Sun added the comment:
I'm closing this as a duplicate of issue 25717. Martin's patch fixes this
problem since it's just another case of _Py_fstat failing for a valid file. In
this case the problem is volume and disk files (e.g. r"\\.\C:" and
r"\\.\Physi
Eryk Sun added the comment:
> There is a problem with os.chdir(): It doesn't work with
> \\?\ notation.
The process current directory is part of the Windows API, so it's subject to
the MAX_PATH limit [1]. See SetCurrentDirectory [2]. Python can't do anything
about this.
Eryk Sun added the comment:
> What we want seems to be a normal thing to do, and achieved by
> some, but perhaps by a post installation script.
It would help to have a couple of the bdist_wininst functions available for a
post-install script:
create_shortcut (CreateSh
Eryk Sun added the comment:
If the examples continue to use printf, then msvcrt.dll is the best option. The
universal CRT exports a single Swiss-Army-knife function,
__stdio_common_vfprintf, which requires 5 parameters, including a va_list for
the variadic argument list. That'
Eryk Sun added the comment:
This a third-party problem due to bugs in the console's support for codepage
65001. For the general problem of Unicode in the console, see issue 1602. The
best way to resolve this problem is by using the wide-character APIs,
WriteConsoleW and ReadConsol
Eryk Sun added the comment:
All of the implemented signals can be registered, and the associated handler
can at least be executed by calling the C raise() function. However, for
pure-Python code only SIGINT and SIGBREAK are really useful.
FYI, Windows doesn't implement POSIX signals a
Eryk Sun added the comment:
For Python 3 you can also make it a keyword-only argument by adding a bare '*'
to the parameter list:
funcs = [(lambda x, *, t=t: x * t) for t in range(5)]
Code that accidentally calls funcs[0](3, 'silent bug ') will raise a TypeError
bec
Eryk Sun added the comment:
> My setup.py creates a .dll then later loads the dll for testing
> using ctypes. Subsequent runs of setup.py that would force
> rebuilding the .dll attempt to delete the old dll first if it
> exists, but I get permission denied.
>
> Oddly,
Eryk Sun added the comment:
The _ctypes extension module provides dlclose on POSIX and FreeLibrary on
Windows. For the reasons already stated in this issue, ctypes should not
automatically call these functions, but maybe they should be documented and
imported to the ctypes module instead of
Eryk Sun added the comment:
As to not being able to delete a loaded DLL on Windows, a workaround that may
help in some instances is to rename it to a temporary name on the same volume.
This is useful for upgrading in place. If you have admin privileges you can
even flag the renamed DLL to be
Eryk Sun added the comment:
%z works correctly in the new CRT that's used by 3.5:
Python 3.5.1 (v3.5.1:37a07cee5969, Dec 6 2015, 01:54:25)
[MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license&qu
Eryk Sun added the comment:
> Does the unlink() work on Windows?
Yes. O_TEMPORARY opens the file with FILE_SHARE_DELETE, so unlink won't raise
an error.
Opening a file creates and returns a handle for a kernel File object that
references the underlying file/link/stream control bloc
Eryk Sun added the comment:
> By your explanation, it sounds like it would be better
> to call unlink() before close().
Sorry, I was responding in general, because I thought you meant unlink would
fail like it would for most open files on Windows, because the CRT normally
doesn't
Eryk Sun added the comment:
Maybe a note could be added to suggest using a SIGTERM signal handler (e.g. the
handler could raise a SIGTERM exception):
POSIX: The file will not be deleted if the process is terminated abruptly by a
signal. A process may register a SIGTERM handler to ensure that
Eryk Sun added the comment:
The error you're getting indicates that stdin is set to binary mode for some
reason. You can see this using the -u command line option:
C:\>py -2 -u
Python 2.7.10 (default, May 23 2015, 09:44:00)
[MSC v.1500 64 bit (AMD64)] on win32
Ty
Eryk Sun added the comment:
Your example worked fine for me with the official 64-bit distribution of 2.7.10
installed in "C:\Program Files\Python27" on Windows 10. I created a junction
from "C:\Py27x64" to the 2.7 installation directory in order to run the example
as pr
Changes by Eryk Sun :
--
resolution: -> duplicate
stage: -> resolved
status: open -> closed
superseder: -> Windows AllUsers installation places uninstaller in user profile
___
Python tracker
<http://bugs.python
Eryk Sun added the comment:
mmap.mmap(-1, 2**31 + 5) could be used here. If the pages are never touched it
won't increase the working set size. It merely maps the address range with
demand-zero pages.
Unpatched:
>>> mmap.mmap(-1, 2**31 + 5).__len__()
-21474
Eryk Sun added the comment:
> the sq_length slot in the weakproxy type is set to proxy_length.
Nice. Its tp_getattro gets in the way of using __len__ directly, but this can
be side stepped by manually binding the descriptor:
class Test(object):
def __len__(s
Eryk Sun added the comment:
os.path.dirname is documented as the first element of os.path.split, which in
turn is documented to be empty when there's no slash in the path.
An empty string is treated as the current directory by os.path.abspath. This is
in line with an empty element i
Eryk Sun added the comment:
> xrange() still functions if you give it a value larger than `long`
What do you mean? Did you mean to write range() instead of xrange()? Both range
and xrange in Python 2 use a C long for the start, stop, step, and length
values. With how they get used t
Eryk Sun added the comment:
> No, I meant to write xrange(). My point is there is no crasher
> if this change didn't occur.
Oh, by 'still functions' you meant that it doesn't cause an access violation
that crashes the process, as opposed to raising an Overflow
Eryk Sun added the comment:
I don't think this is Windows related. Are you using 32-bit Python? On Linux,
if I limit the process address space to 2 gigs, it crashes almost immediately:
$ ulimit -v 200
$ python-dbg -c 'import crash'
Segmentation fault
It run
Eryk Sun added the comment:
> My Python is 64-bit, but my computer only has 2GB physical RAM.
That explains why it takes half an hour to crash. It's thrashing on page
faults. Adding another paging file or increasing the size of your current
paging file should allow this to finish
Changes by Eryk Sun :
--
stage: -> resolved
___
Python tracker
<http://bugs.python.org/issue26447>
___
___
Python-bugs-list mailing list
Unsubscrib
Changes by Eryk Sun :
--
versions: +Python 3.6
___
Python tracker
<http://bugs.python.org/issue26464>
___
___
Python-bugs-list mailing list
Unsubscribe:
Eryk Sun added the comment:
It duplicates translated characters as well. For example:
>>> table = str.maketrans('mnopqrb', 'rqponm\u0100', 'a')
>>> 'aamnopqrb'.translate(table)
'rqponmrqponmĀ'
3.4 returns t
Eryk Sun added the comment:
When Python creates an exception generically from a Windows error code, it
calls WinAPI FormatMessage with the flag FORMAT_MESSAGE_IGNORE_INSERTS. The
reason for this is explained in a blog post written by Raymond Chen[1]: "when
you are not in control o
Eryk Sun added the comment:
It would be possible for subprocess to replace "%1" with the filename parsed
from the command line and then re-raise the exception. That said, it's not as
if this is a deficiency in the Windows implementation relative to subprocess on
POSIX. For exa
Changes by Eryk Sun :
--
resolution: -> works for me
stage: -> resolved
status: open -> closed
___
Python tracker
<http://bugs.python.org/issue26514>
___
___
Eryk Sun added the comment:
This problem has come up in several issues now (see issue 25376 and issue
26531). I'm adding a patch for Python 3.6 to call ReadConsoleA instead of fgets
in PyOS_Readline. This fixes Ctrl+C and EOF handling in Windows 10 for both the
interactive shell and the
Eryk Sun added the comment:
Background Discussion
The Windows 10 console uses the condrv.sys device driver, which is set up as
follows in the NT namespace:
C:\>odir \ -r -n con;con*$;cond*
Directory of \
Device
ConDrv
Driver
condrv
GLOBAL??
Eryk Sun added the comment:
I occasionally come across code snippets on Stack Overflow, and projects such
as win-unicode-console (IIRC), that use ctypes to work with C stdio FILE
streams (sometimes for dubious reasons, such as a DLL API that uses FILE
streams). Maybe the _ctypes extension
Eryk Sun added the comment:
For posterity for anyone that finds this old issue, I investigated this problem
in the debugger in Windows 7. It turns out that more.com (the pager used by
Python's help) calls MultiByteToWideChar [1] with dwFlags passed as
MB_PRECOMPOSED (1), which is forb
Eryk Sun added the comment:
NumPy is not part of Python's standard library, so this is a 3rd party problem.
However, please don't waste the time of the NumPy developers with this. You
either haven't read the documentation or have misread it. numpy.all [1] is an
AND red
Changes by Eryk Sun :
--
components: +Windows
nosy: +paul.moore, steve.dower, tim.golden, zach.ware
resolution: -> duplicate
stage: -> resolved
status: open -> closed
superseder: -> bdist_wininst created binaries fail to start and find 32
Eryk Sun added the comment:
> work off its __name__ and __module__
Why is __module__ required? It seems to me this should only operate on the
current module.
I added a prototype to Python/bltinmodule.c that gets or creates the __all__
list from the current globals (i.e. PyEval_GetGlob
Eryk Sun added the comment:
> I would strongly argue to generally prohibit this
> with an exception
I agree. A warning in the tutorial isn't sufficient. ctypes should raise an
error when setting a union or bitfield struct type in argtypes or when passing
one by value.
Here's
Eryk Sun added the comment:
The `value` of a c_char_p or c_wchar_p pointer is a Python bytes or str object.
Since `value` won't consistently be the address value, it may be better to
introduce a read-only `as_void` attribute that can be implemented consistently
for all pointer
1901 - 2000 of 2115 matches
Mail list logo