[issue43304] THONNY 3.3.0 failing to install package MULTIPROCESSING

2021-02-22 Thread Noel del Rosario


New submission from Noel del Rosario :

I am actually using a PYTHON IDE called THONNY 3.3.-
and I am not geting any success to install the package
MULTI{ROCESSING. Error message is shown below.

requirement multiprocessing
ERROR: No matching distribution found for multiprocessing
Process returned with code 1

--
messages: 387553
nosy: gvanrossum, rosarion2
priority: normal
severity: normal
status: open
title: THONNY 3.3.0 failing to install package MULTIPROCESSING
versions: Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43303] ASAN : Memory leak in compilation

2021-02-22 Thread Ramin Farajpour Cami


Change by Ramin Farajpour Cami :


--
nosy: +christian.heimes, lys.nikolaou, pablogsal

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1152248] Add support for reading records with arbitrary separators to the standard IO stack

2021-02-22 Thread Christoph Anton Mitterer


Christoph Anton Mitterer  added the comment:

btw, just something for the record:

I think the example given in msg109117 above is wrong:

Depending on the read size it will produce different results, given how split() 
works:

Imagine a byte sequence:
>>> b"\0foo\0barbaz\0\0abcd".split(b"\0")
[b'', b'foo', b'barbaz', b'', b'abcd']


Now the same sequence, however with a different read size (here a shorter one):
>>> b"\0foo\0barbaz\0".split(b"\0")
[b'', b'foo', b'barbaz', b'']
>>> b"\0abcd".split(b"\0")
[b'', b'abcd']

=> it's the same bytes, but in the 2nd case one get's an extra b''.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43303] ASAN : Memory leak in compilation

2021-02-22 Thread Ramin Farajpour Cami


New submission from Ramin Farajpour Cami :

Hi,


Asan has detected a memory leak :

$ wget https://github.com/python/cpython/archive/v3.9.2.tar.gz
$ tar xvf v3.9.2.tar.gz
$ ./configure --disable-shared CFLAGS="-fsanitize=address -ggdb" 
CXXFLAGS="-fsanitize=address -ggdb" LDFLAGS="-fsanitize=address"
$ make -j4
$ ~/cpython-3.9.2# ./python -E -S -m sysconfig --generate-posix-vars

=
==330505==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 300082 byte(s) in 137 object(s) allocated from:
#0 0x7f647a692bc8 in malloc (/lib/x86_64-linux-gnu/libasan.so.5+0x10dbc8)
#1 0x55a58e972015 in PyMem_RawMalloc Objects/obmalloc.c:572
#2 0x55a58e972015 in _PyObject_Malloc Objects/obmalloc.c:1645
#3 0x55a58e972015 in _PyObject_Malloc Objects/obmalloc.c:1638

Direct leak of 2066 byte(s) in 2 object(s) allocated from:
#0 0x7f647a692ffe in __interceptor_realloc 
(/lib/x86_64-linux-gnu/libasan.so.5+0x10dffe)
#1 0x55a58e9c9e7d in resize_compact Objects/unicodeobject.c:1079

Direct leak of 672 byte(s) in 1 object(s) allocated from:
#0 0x7f647a692ffe in __interceptor_realloc 
(/lib/x86_64-linux-gnu/libasan.so.5+0x10dffe)
#1 0x55a58eb6c620 in _PyObject_GC_Resize Modules/gcmodule.c:2297

Indirect leak of 110001 byte(s) in 115 object(s) allocated from:
#0 0x7f647a692bc8 in malloc (/lib/x86_64-linux-gnu/libasan.so.5+0x10dbc8)
#1 0x55a58e972015 in PyMem_RawMalloc Objects/obmalloc.c:572
#2 0x55a58e972015 in _PyObject_Malloc Objects/obmalloc.c:1645
#3 0x55a58e972015 in _PyObject_Malloc Objects/obmalloc.c:1638

Indirect leak of 536 byte(s) in 1 object(s) allocated from:
#0 0x7f647a692bc8 in malloc (/lib/x86_64-linux-gnu/libasan.so.5+0x10dbc8)
#1 0x55a58e972382 in _PyObject_Malloc Objects/obmalloc.c:572
#2 0x55a58e972382 in pymalloc_realloc Objects/obmalloc.c:1988
#3 0x55a58e972382 in _PyObject_Realloc Objects/obmalloc.c:2007

SUMMARY: AddressSanitizer: 413357 byte(s) leaked in 256 allocation(s).


Thanks,
Ramin

--
components: Build
messages: 387551
nosy: Ramin Farajpour Cami
priority: normal
severity: normal
status: open
title: ASAN : Memory leak in compilation
type: resource usage
versions: Python 3.10, Python 3.8, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43295] datetime.strptime emits IndexError on parsing 'z' as %z

2021-02-22 Thread Noor Michael


Change by Noor Michael :


--
keywords: +patch
pull_requests: +23411
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/24627

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43295] datetime.strptime emits IndexError on parsing 'z' as %z

2021-02-22 Thread Noor Michael

Noor Michael  added the comment:

I will address the original issue regarding '%z', but the second issue actually 
has to do with the Unicode representation of Turkish characters. In Turkish, 
the letter I ('\u0049') is a capital ı ('\u0131') and the letter İ ('\u0130') 
is a capital i ('\u0069'). In Python however, the lowercase of I is i, as in 
English.

>>> '\u0049'.lower()
'i'
>>> '\u0130'.lower()
'i̇'

We see that the lowercase forms of both I and İ are i, consistent with English 
in one case and Turkish in the other.

--
nosy: +noormichael

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23882] unittest discovery doesn't detect namespace packages when given no parameters

2021-02-22 Thread Inada Naoki


Inada Naoki  added the comment:

I noticed that namespace package support has been broken since this commit.
https://github.com/python/cpython/commit/bbbcf8693b876daae4469765aa62f8924f39a7d2

Now namespace pacakge has __file__ attribute which is None. But...

try:
start_dir = os.path.abspath(
   os.path.dirname((the_module.__file__)))
except AttributeError:
# look for namespace packages

`the_module.__file__` doesn't raise AttributeError for now. But 
os.path.dirname(None) raise TypeError.

The commit is backported to 3.7 branch. So namespace package support has been 
broken since Python 3.7.

Shouldn't we drop namespace package support?
It is misleading. And we could not maintain it. We didn't notice that it is 
broken for 3 years!

--
nosy: +barry
resolution: fixed -> 
stage: resolved -> needs patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43295] datetime.strptime emits IndexError on parsing 'z' as %z

2021-02-22 Thread itchyny

itchyny  added the comment:

I noticed another unexpectedeffect of the IGNORECASE flag. It enables some 
non-ascii characters to match against the alphabets.

>>> from datetime import datetime
>>> datetime.strptime("Apr\u0130l", "%B")
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/local/lib/python3.9/_strptime.py", line 568, in _strptime_datetime
tt, fraction, gmtoff_fraction = _strptime(data_string, format)
  File "/usr/local/lib/python3.9/_strptime.py", line 391, in _strptime
month = locale_time.f_month.index(found_dict['B'].lower())
ValueError: 'apri̇l' is not in list

I expect time data does not match error. The ASCII flag will disable matching 
unexpected unicode characters.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42800] Traceback objects allow accessing frame objects without triggering audit hooks

2021-02-22 Thread Ryan Hileman


Ryan Hileman  added the comment:

> Sounds good to me. We can deprecate RESTRICTED with no intention to 
remove it, since it's documented.
> Do you want to prepare a PR for this?

In case you missed it, the attached PR 24182 as of commit d3e998b is based on 
the steps I listed - I moved all of the proposed audited properties over to a 
new AUDIT_READ flag that is much simpler.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36346] Prepare for removing the legacy Unicode C API

2021-02-22 Thread miss-islington


miss-islington  added the comment:


New changeset 93853b73b666a0ffbf5aaee8894659580581f7d3 by Miss Islington (bot) 
in branch '3.9':
bpo-36346: Document removal schedule of deprecate APIs (GH-20879)
https://github.com/python/cpython/commit/93853b73b666a0ffbf5aaee8894659580581f7d3


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36346] Prepare for removing the legacy Unicode C API

2021-02-22 Thread miss-islington


Change by miss-islington :


--
pull_requests: +23410
pull_request: https://github.com/python/cpython/pull/24626

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36346] Prepare for removing the legacy Unicode C API

2021-02-22 Thread miss-islington


Change by miss-islington :


--
pull_requests: +23409
pull_request: https://github.com/python/cpython/pull/24625

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36346] Prepare for removing the legacy Unicode C API

2021-02-22 Thread Inada Naoki


Inada Naoki  added the comment:


New changeset 2d6f2eed14ff5d89155b52771cc8ef957e8145b4 by Inada Naoki in branch 
'master':
bpo-36346: Document removal schedule of deprecate APIs (GH-20879)
https://github.com/python/cpython/commit/2d6f2eed14ff5d89155b52771cc8ef957e8145b4


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43042] Augment tutorial sentence.

2021-02-22 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
keywords:  -patch
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43301] Update form create for android

2021-02-22 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Candra: This is neither a help forum nor a free programming service.   It is a 
workspace for improving the CPython distribution of Python.  CPython does not 
run on Android.  Anything to do with Android is off-topic here.  Please do not 
reopen this again or otherwise change any of the headers.

--
nosy: +terry.reedy
resolution: postponed -> not a bug
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43274] Backlinks Strong decouverte SSL

2021-02-22 Thread Ned Deily


Change by Ned Deily :


--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43274] Backlinks Strong decouverte SSL

2021-02-22 Thread Ned Deily


Ned Deily  added the comment:

https://docs.python.org/fr/3/library/ssl.html#ssl.OPENSSL_VERSION

--
nosy: +ned.deily

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23882] unittest discovery doesn't detect namespace packages when given no parameters

2021-02-22 Thread Md Jony Hossain Habib


Md Jony Hossain Habib  added the comment:

diff -r 293d9964cf6e Lib/unittest/loader.py
--- a/Lib/unittest/loader.pyTue Apr 28 00:04:53 2015 -0400
+++ b/Lib/unittest/loader.pyTue Apr 28 10:12:07 2015 +0300
@@ -338,7 +338,7 @@
 raise ImportError('Start directory is not importable: %r' % 
start_dir)
 
 if not is_namespace:
-tests = list(self._find_tests(start_dir, pattern))
+tests = list(self._find_tests(start_dir, pattern, namespace=True))
 return self.suiteClass(tests)
 
 def _get_directory_containing_module(self, module_name):
@@ -403,7 +403,7 @@
 name = self._get_name_from_path(full_path)
 self._loading_packages.add(name)
 try:
-yield from self._find_tests(full_path, pattern, namespace)
+yield from self._find_tests(full_path, pattern, False)
 finally:
 self._loading_packages.discard(name)
 
diff -r 293d9964cf6e Lib/unittest/test/test_program.py
--- a/Lib/unittest/test/test_program.py Tue Apr 28 00:04:53 2015 -0400
+++ b/Lib/unittest/test/test_program.py Tue Apr 28 10:12:07 2015 +0300
@@ -16,7 +16,7 @@
 expectedPath = os.path.abspath(os.path.dirname(unittest.test.__file__))
 
 self.wasRun = False
-def _find_tests(start_dir, pattern):
+def _find_tests(start_dir, pattern, namespace):
 self.wasRun = True
 self.assertEqual(start_dir, expectedPath)
 return tests

--
nosy: +mdjonyhossainhabib

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43296] [sqlite3] sqlite3_value_bytes() should be called after sqlite3_value_blob()

2021-02-22 Thread Erlend Egeberg Aasland


Erlend Egeberg Aasland  added the comment:

Related:
If sqlite3_value_blob() returns NULL, we should check if sqlite3_errcode() 
equals SQLITE_NOMEM and raise MemoryError if it does.

If not, we should initialise cur_py_value to None, because as the 
PyBytes_FromStringAndSize docs says: "If v is NULL, the contents of the bytes 
object are uninitialized."

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43300] "bisect" module should support reverse-sorted sequences

2021-02-22 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I prefer option 5 and leaving the module as-is.  The bisect module api is slice 
oriented and, in general, people have a hard time reasoning about slices for 
reverse ordered sequences.  Even the forward ordered API is a bit awkward so 
that we had to document how to implement find_lt(), find_le(), etc. because it 
wasn't obvious how to do so.  Also, it doesn't seem to come-up much (the bisect 
module is over two decades old).  So, I don't think the API and the internals 
should be gummed up for this.

My vote is -1 because it would cause more problems than it would solve.  Let's 
cater to the common use cases rather than every possible variant.

--
nosy: +rhettinger

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42627] urllib.request.getproxies() misparses Windows registry proxy settings

2021-02-22 Thread 双草酸酯

Change by 双草酸酯 :


--
components: +Library (Lib)

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42627] urllib.request.getproxies() misparses Windows registry proxy settings

2021-02-22 Thread 双草酸酯

Change by 双草酸酯 :


--
components: +Windows -Library (Lib)

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43260] Never release buffer when MemoryError in print()

2021-02-22 Thread STINNER Victor


STINNER Victor  added the comment:

I didn't understand the bug but thanks for fixing it :)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24905] Allow incremental I/O to blobs in sqlite3

2021-02-22 Thread Erlend Egeberg Aasland


Change by Erlend Egeberg Aasland :


--
nosy: +erlendaasland

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43261] Python 3.9 repair on Windows do not recover pip module

2021-02-22 Thread Steve Dower


Steve Dower  added the comment:

Assuming you installed pip using the installer, repair should bring it back.

Do you still have installer logs? They would be in %TEMP% and start with 
"python". We'll need at least the main log and the pip log, but if you want to 
just zip them all up and attach them here that would be great.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42938] [security][CVE-2021-3177] ctypes double representation BoF

2021-02-22 Thread Alexander Riccio


Alexander Riccio  added the comment:

Yes, I definitely should. I work on https://bugs.python.org/issue25878 
sometimes, which encompasses this.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42938] [security][CVE-2021-3177] ctypes double representation BoF

2021-02-22 Thread Christian Heimes


Christian Heimes  added the comment:

Alexander, this bug report is closed. Could you please open a new request and 
explain your proposal?

--
nosy: +christian.heimes

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42938] [security][CVE-2021-3177] ctypes double representation BoF

2021-02-22 Thread Alexander Riccio


Alexander Riccio  added the comment:

Petition to remove all uses of the unchecked string handling functions from 
CPython?

Sidenote: if C4996 was on, this would be a warning.

--
nosy: +Alexander Riccio

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43301] Update form create for android

2021-02-22 Thread Candra Wijaya


Candra Wijaya  added the comment:

One again need

--
resolution: not a bug -> postponed
status: closed -> open
versions: +Python 3.10

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43298] Windows build cannot detect missing Windows SDK

2021-02-22 Thread Eryk Sun


Change by Eryk Sun :


--
Removed message: https://bugs.python.org/msg387522

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43298] Windows build cannot detect missing Windows SDK

2021-02-22 Thread Eryk Sun


Change by Eryk Sun :


--
Removed message: https://bugs.python.org/msg387525

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43298] Windows build cannot detect missing Windows SDK

2021-02-22 Thread Eryk Sun


Change by Eryk Sun :


--
Removed message: https://bugs.python.org/msg387521

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43302] spam

2021-02-22 Thread Eryk Sun


Change by Eryk Sun :


--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed
title: shutil. copy file throws incorrect SameFileError on Google Drive File 
Stream -> spam

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43298] Windows build cannot detect missing Windows SDK

2021-02-22 Thread Kevin Thomas


Kevin Thomas  added the comment:

Thank you Steve.  I did not have the latest installed which is 
Win10SDK_10.0.18362, therefore it did trigger that original error in msg387518.

After installing, Win10SDK_10.0.18362, it did in-fact allow a successful 
compilation.

Updating that error code would be most helpful to Windows developers.  I would 
have never caught it but I wanted to help test 3.10 so I thought I should try 
it on the Windows 10 box to make sure the community had all platforms covered.

RESULTS:
Build succeeded.
0 Warning(s)
0 Error(s)

Time Elapsed 00:01:10.34

C:\Users\kevin\cpython>python.bat
Running Release|x64 interpreter...
Python 3.10.0a5+ (heads/master:91a639a094, Feb 22 2021, 14:01:03) [MSC v.1928 
64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23882] unittest discovery doesn't detect namespace packages when given no parameters

2021-02-22 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

>From the merge:

+++ b/Doc/library/unittest.rst
@@ -330,7 +330,9 @@ Test modules and packages can customize test loading and 
discovery by through
 the `load_tests protocol`_.
 
 .. versionchanged:: 3.4
-   Test discovery supports :term:`namespace packages `.
+   Test discovery supports :term:`namespace packages `
+   for start directory. Note that you need to the top level directory too.
+   (e.g. ``python -m unittest discover -s root/namespace -t root``).
 
The last sentence is missing a verb after 'you need to' saying what to do about 
"the top level directory.  "be in"?  "go to"?  "later destroy"? (just kidding 
;-)

--
nosy: +terry.reedy
status: closed -> open

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27875] Syslogs /usr/sbin/foo as /foo instead of as foo

2021-02-22 Thread Hans Deragon


Change by Hans Deragon :


--
versions: +Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43302] shutil. copy file throws incorrect SameFileError on Google Drive File Stream

2021-02-22 Thread Coleman


New submission from Coleman :

When using shuttle. copy file on the Google Drive File Stream file way, an 
incorrect SameFileError can happen. 

MWE (assuming foo.txt exists in your google drive G:\\):
>>> f1 = 'G:\\My Drive\\foo.txt'
>>> f2 = 'G:\\My Drive\\foo2.txt'
>>> import shutil
>>> shutil.copyfile(f1, f2)
>>> shutil.copyfile(f1, f2)

--> Last line throws incorrect SameFileError. In contrast, executing the same 
code on a different file operation(e.g. local hard drive) will result in no 
errors.

More details described here: 
https://apkwill.com/

The error originates in the library in generalpath.py in the function same 
stat: Google Drive File Stream reports inode==0 which makes os. path.same 
file(f1, f2) == True for any files f1 and f2 on Google File Stream.

I suggest the following patch, which currently works for me:

--- genericpath.py  2018-06-22 02:14:27.145744900 +0200
+++ genericpath_new.py  2018-06-22 02:10:44.485961100 +0200
@@ -86,8 +86,11 @@
 # describing the same file?
 def samestat(s1, s2):
 """Test whether two stat buffers reference the same file"""
-return (s1.st_ino == s2.st_ino and
-s1.st_dev == s2.st_dev)
+return (s1.st_ino != 0 and
+   s2.st_ino != 0 and
+   s1.st_ino == s2.st_ino and
+s1.st_dev == s2.st_dev)
+


 # Are two filenames actually pointing to the very file?

--
components: Library (Lib)
messages: 387531
nosy: Deniz Bozyigit, White1, alexkowel, eryksun
priority: normal
severity: normal
status: open
title: shutil. copy file throws incorrect SameFileError on Google Drive File 
Stream
versions: Python 3.7, Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43301] Update form create for android

2021-02-22 Thread Éric Araujo

Change by Éric Araujo :


Removed file: https://bugs.python.org/file49828/api.paypal.com.pem

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43301] Update form create for android

2021-02-22 Thread Éric Araujo

Éric Araujo  added the comment:

This does not look like a valid bug report.

You can use a general Python support group to ask questions about how to write 
something, the Python bug tracker is not the right place for that.

--
assignee: terry.reedy -> 
nosy:  -barry, dstufft, ezio.melotti, koobs, mrabarnett, r.david.murray, 
terry.reedy
resolution: works for me -> not a bug
stage:  -> resolved
status: open -> closed
type: crash -> 
versions:  -Python 3.10, Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43298] Windows build cannot detect missing Windows SDK

2021-02-22 Thread Steve Dower


Steve Dower  added the comment:

This should mean that you haven't got the Windows SDK installed, though it 
might mean that you've got a *newer* WinSDK where they've changed the 
registration format.

But more likely you deselected it when installing C++ support through Visual 
Studio. Could you open Visual Studio Installer and ensure that the newest 
Windows SDK item is selected?

Assuming the spammers go away, we can use this bug to improve the error 
message. If they persist, we'll lock this and open a new one.

--
title: Windows build issue -> Windows build cannot detect missing Windows SDK

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43299] pyclbr.readmodule_ex traversing "import __main__": dies with ValueError: __main__.__spec__ is None / is not set

2021-02-22 Thread Robert


Change by Robert :


--
keywords: +patch
pull_requests: +23407
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/24623

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43301] Update form create for android

2021-02-22 Thread Candra Wijaya


Candra Wijaya  added the comment:

I need creat Payment

--
resolution:  -> works for me
Added file: https://bugs.python.org/file49828/api.paypal.com.pem

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43301] Update form create for android

2021-02-22 Thread Candra Wijaya


New submission from Candra Wijaya :

I need documend create sistems

--
assignee: terry.reedy
components: C API, Demos and Tools, Distutils, FreeBSD, IDLE, Installation, 
Regular Expressions, Tests, ctypes, email
messages: 387527
nosy: barry, dstufft, eric.araujo, ezio.melotti, koobs, mrabarnett, 
r.david.murray, sirsak406, terry.reedy
priority: normal
severity: normal
status: open
title: Update form create for android
type: crash
versions: Python 3.10, Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41100] Support macOS 11 and Apple Silicon Macs

2021-02-22 Thread Gregory Szorc


Gregory Szorc  added the comment:

I ran into a minor issue with the ctypes extension and the 
_dyld_shared_cache_contains_path dependency that was added as part of this work 
(commit e8b1c038b14b5fc8120aab62c9bf5fb840274cb6).

When building on Intel macOS 10.15 using an 11.x SDK, the configure check for 
this symbol passes (#define HAVE_DYLD_SHARED_CACHE_CONTAINS_PATH 1) and the 
extension compiles (albeit with a lot of deprecation warnings spewing from the 
Apple SDK headers). However, at run-time, we blow up due to a missing symbol 
error:

```
2021-02-21T21:57:21.4116370Z cpython-3.9> clang -bundle -undefined 
dynamic_lookup -isysroot 
/Applications/Xcode_12.4.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk
 
build/temp.macosx-11.0-x86_64-3.9/private/var/folders/24/8k48jl6d249_n_qfxwsl6xvmgn/T/tmpasb48bzk/Python-3.9.2/Modules/_decimal/_decimal.o
 
build/temp.macosx-11.0-x86_64-3.9/private/var/folders/24/8k48jl6d249_n_qfxwsl6xvmgn/T/tmpasb48bzk/Python-3.9.2/Modules/_decimal/libmpdec/basearith.o
 
build/temp.macosx-11.0-x86_64-3.9/private/var/folders/24/8k48jl6d249_n_qfxwsl6xvmgn/T/tmpasb48bzk/Python-3.9.2/Modules/_decimal/libmpdec/constants.o
 
build/temp.macosx-11.0-x86_64-3.9/private/var/folders/24/8k48jl6d249_n_qfxwsl6xvmgn/T/tmpasb48bzk/Python-3.9.2/Modules/_decimal/libmpdec/context.o
 
build/temp.macosx-11.0-x86_64-3.9/private/var/folders/24/8k48jl6d249_n_qfxwsl6xvmgn/T/tmpasb48bzk/Python-3.9.2/Modules/_decimal/libmpdec/convolute.o
 build/temp.macosx-11.0-x86_64-3.9/private/var/fol
 
ders/24/8k48jl6d249_n_qfxwsl6xvmgn/T/tmpasb48bzk/Python-3.9.2/Modules/_decimal/libmpdec/crt.o
 
build/temp.macosx-11.0-x86_64-3.9/private/var/folders/24/8k48jl6d249_n_qfxwsl6xvmgn/T/tmpasb48bzk/Python-3.9.2/Modules/_decimal/libmpdec/difradix2.o
 
build/temp.macosx-11.0-x86_64-3.9/private/var/folders/24/8k48jl6d249_n_qfxwsl6xvmgn/T/tmpasb48bzk/Python-3.9.2/Modules/_decimal/libmpdec/fnt.o
 
build/temp.macosx-11.0-x86_64-3.9/private/var/folders/24/8k48jl6d249_n_qfxwsl6xvmgn/T/tmpasb48bzk/Python-3.9.2/Modules/_decimal/libmpdec/fourstep.o
 
build/temp.macosx-11.0-x86_64-3.9/private/var/folders/24/8k48jl6d249_n_qfxwsl6xvmgn/T/tmpasb48bzk/Python-3.9.2/Modules/_decimal/libmpdec/io.o
 
build/temp.macosx-11.0-x86_64-3.9/private/var/folders/24/8k48jl6d249_n_qfxwsl6xvmgn/T/tmpasb48bzk/Python-3.9.2/Modules/_decimal/libmpdec/mpalloc.o
 
build/temp.macosx-11.0-x86_64-3.9/private/var/folders/24/8k48jl6d249_n_qfxwsl6xvmgn/T/tmpasb48bzk/Python-3.9.2/Modules/_decimal/libmpdec/mpdecimal
 .o 
build/temp.macosx-11.0-x86_64-3.9/private/var/folders/24/8k48jl6d249_n_qfxwsl6xvmgn/T/tmpasb48bzk/Python-3.9.2/Modules/_decimal/libmpdec/numbertheory.o
 
build/temp.macosx-11.0-x86_64-3.9/private/var/folders/24/8k48jl6d249_n_qfxwsl6xvmgn/T/tmpasb48bzk/Python-3.9.2/Modules/_decimal/libmpdec/sixstep.o
 
build/temp.macosx-11.0-x86_64-3.9/private/var/folders/24/8k48jl6d249_n_qfxwsl6xvmgn/T/tmpasb48bzk/Python-3.9.2/Modules/_decimal/libmpdec/transpose.o
 
-L/var/folders/24/8k48jl6d249_n_qfxwsl6xvmgn/T/tmpasb48bzk/tools/pyhost/lib 
-L/usr/local/lib -lm -o 
build/lib.macosx-11.0-x86_64-3.9/_decimal.cpython-39-darwin.so
2021-02-21T21:57:27.1635100Z cpython-3.9> *** WARNING: renaming "_ctypes" since 
importing it failed: 
dlopen(build/lib.macosx-11.0-x86_64-3.9/_ctypes.cpython-39-darwin.so, 2): 
Symbol not found: __dyld_shared_cache_contains_path
2021-02-21T21:57:27.1637220Z cpython-3.9>   Referenced from: 
build/lib.macosx-11.0-x86_64-3.9/_ctypes.cpython-39-darwin.so (which was built 
for Mac OS X 11.0)
2021-02-21T21:57:27.1638560Z cpython-3.9>   Expected in: 
/usr/lib/libSystem.B.dylib
2021-02-21T21:57:27.1639770Z cpython-3.9>  in 
build/lib.macosx-11.0-x86_64-3.9/_ctypes.cpython-39-darwin.so
```

(This build output is from 
https://github.com/indygreg/python-build-standalone/runs/1947611547?check_suite_focus=true)

The missing symbol is provided by libdyld.dylib, which doesn't appear to be 
linked directly by CPython's build system.

I'm only able to reproduce this on a GitHub Actions 10.5 machine using the 11.1 
SDK: it seems to work fine on both an 11.1 Intel and M1 device.

I reckon the correct fix is to have _ctypes link libdyld is this build 
configuration. I was also able to work around it in python-build-standalone by 
unsetting HAVE_DYLD_SHARED_CACHE_CONTAINS_PATH (hacky solution but this feature 
isn't needed by the build that was failing). And of course linking a non-Apple 
libffi should also work, which is potentially why pyenv/Homebrew/etc users 
aren't noticing.

python-build-standalone uses its own Clang built from source, so it is entirely 
possible there's something differing between the Apple Clang and my Clang 
causing this to fail. However, at least 1 other person ran into this in the 
wild 
(https://stackoverflow.com/questions/65853539/symbol-not-found-dyld-shared-cache-contains-path-on-osx-after-installl-from),
 so it might be generic.


[issue43298] Windows build issue

2021-02-22 Thread Coleman


Coleman  added the comment:

You can visit the link below and download the games without any problems.
https://apkwill.com

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43247] How to search for a __main__ module using pyclbr in Python3?

2021-02-22 Thread Robert


Robert  added the comment:

#  `__main__` of the source code directory: `/tmp/rebound/rebound`. 
#  differentiate `__main__` of my target source code to read from the built-in 
`__main__`? In other words, how do I read the module `__main__` of the 
codebase: rebound?

=> when __main__.py is inside a package, use the full dotted module name - and 
an appropriate search path below that directory:

pyclbr.readmodule_ex('rebound.__main__')
pyclbr.readmodule_ex('lib2to3.__main__')

When __main__.py is intended as a top level module / script, I think such a 
name collision with an internal module name is a bad idea at all.
(For a special local purposes you could use a symlink or so?)


(I experience a bug with pyclbr (in py3.10 at least) when it traverses an 
"import __main__" statement. It causes also "ValueError: __main__.__spec__ is 
None" or "ValueError: {}.__spec__ is not set".  But this seems to be an actual 
bug w/o bug report so far: #43299 )

--
nosy: +kxrob

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43300] "bisect" module should support reverse-sorted sequences

2021-02-22 Thread James Murphy


New submission from James Murphy :

Currently, the bisect module's functions all assume the user is maintaining a 
sorted list/sequence in increasing order. From the docs:

"This module provides support for maintaining a list in sorted order without 
having to sort the list after each insertion"

However, bisection is not limited to this use case, nor is it limited to 
increasing sequences. Many algorithms involve bisecting a sequence derived from 
(potentially immutable) user input, such as the standard 
longest-increasing-subsequence algorithm. Sometimes these derived sequences are 
naturally reverse-sorted, as they would be in the 
longest-decreasing-subsequence algorithm. (I have personally had to work around 
bisect not working with decreasing sequences in this case). There are other 
natural reasons for a reverse-sorted list to appear that one might want to 
bisect. Of course, a monotone decreasing function applied to a sorted list 
would result in a reverse-sorted one. One may want to use bisect as a 
root-finding algorithm for a decreasing function that may not be differentiable 
(or even continuous). Or a user may simply have chosen to reverse-sort using 
sorted(a, reverse=True).

In my mind, the bisect module's purpose should be to support common use cases 
of bisection, not specifically to maintain a sorted list.

So then the question arises, how to support reverse-sorted sequences? I see a 
few possible routes.

1. Add a "decreasing" parameter to bisect_left, bisect_right, (and perhaps 
insort_left, insort_right as well).

2. Add dedicated functions bisect_left_decreasing, bisect_right_decreasing, 
(and perhaps insort_left_decreasing, insort_right_decreasing as well) that 
operate on reverse-sorted sequences.

3. Add a more general bisect_first_false(a, pred, lo, hi) (equivalent to C++'s 
std::partition_point) that assumes the sequence to be partitioned with respect 
to the predicate function and returns the first index such that the predicate 
is falsey, or hi if no falsey elements are found. Then reverse-sorted lists can 
be bisected with something like bisect_first_false(a, lambda y: y > x). This 
way may be too general, but it becomes very obvious what operators will be 
called on the values and what the post-condition of the function is, similar to 
the condition of a while loop.

4. Add a "cmp" parameter to bisect_left, bisect_right, (and perhaps 
insort_left, insort_right as well) that keys are meant to be compared with, so 
one would pass bisect_left(a, x, cmp=operator.gt). It could be used in 
conjuction with "key", i.e. "cmp" is not meant to be a replacement for "key" as 
it was with sorted.

5. Do nothing. People who _really_ want to bisect reverse-sorted lists will 
write their own bisect_*_decreasing or figure out that if "a" is 
reverse-sorted, the following monstrosity does the job, making ab(use) of the 
new "key" parameter in 3.10 and due to the fact that False < True:

a = ... # reverse-sorted
x = ...

# bisect left on reverse-sorted
pred = lambda y: not (x < y)
idx = bisect_left(a, x, key=pred)

# bisect right on reverse-sorted
pred = lambda y: y < x
idx = bisect_right(a, x, key=pred)


Commentary on the choices. 1 or 4 are the most convenient from a user 
perspective, no extra imports and discoverable behavior. 4 also has the benefit 
that the element/key class does not need to define a __lt__, which can be 
useful in cases where the element/key has many comparable attributes and it 
does not make sense to pick one to be used to define a __lt__. 3 would have the 
most generality and usefulness to library writers, who would probably be the 
primary users in need of a reverse-sorted bisection implementation. 2 suffers 
from combinatorial explosion (many new functions) and extra importing needed, 
but allows the implementation of existing functions to be unchanged, as well as 
mildly discouraging users from using it unless they _really_ want to use it. 5 
will lead to many incorrect home-grown bisection searches or other hacks being 
used in the wild.

Personally, I am somewhat indifferent between 1 and 4, perhaps slightly 
learning towards 4 as it makes explicit exactly how elements/keys will be 
compared. I would like to see 3 implemented as well, but admit that it is 
likely too general a solution for the proposed issue "support reverse-sorted 
lists".

--
components: Library (Lib)
messages: 387523
nosy: mCoding
priority: normal
severity: normal
status: open
title: "bisect" module should support reverse-sorted sequences
type: enhancement
versions: Python 3.10

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43298] Windows build issue

2021-02-22 Thread Coleman


Coleman  added the comment:

HI Msg

--
nosy: +White1

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43298] Windows build issue

2021-02-22 Thread Zack


Zack  added the comment:

Hello. I want to record a game in Windows 7 and I can not install it can you 
help me

--
nosy: +Zack_Barton

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43299] pyclbr.readmodule_ex traversing "import __main__": dies with ValueError: __main__.__spec__ is None / is not set

2021-02-22 Thread Robert


New submission from Robert :

When pyclbr.readmodule_ex() is traversing "import __main__" or another 
module without __spec__, it dies completely 
with "ValueError: __main__.__spec__ is None / is not set".

=> It should at least continue with the (big) rest 
as the comment in _ModuleBrowser.visit_Import() says:
# If we can't find or parse the imported module,
# too bad -- don't die here.

And optionally fall back to using __file__ when present?


Traceback (most recent call last):
  File 
"C:\Python310\Lib\site-packages\pythonwin\pywin\framework\editor\ModuleBrowser.py",
 line 128, in OnActivateView
self.CheckRefreshList()
  File 
"C:\Python310\Lib\site-packages\pythonwin\pywin\framework\editor\ModuleBrowser.py",
 line 181, in CheckRefreshList
self.CheckMadeList()
  File 
"C:\Python310\Lib\site-packages\pythonwin\pywin\framework\editor\ModuleBrowser.py",
 line 173, in CheckMadeList
self.rootitem = root = self._MakeRoot()
  File 
"C:\Python310\Lib\site-packages\pythonwin\pywin\framework\editor\ModuleBrowser.py",
 line 153, in _MakeRoot
data = reader(mod, path and [path])
  File "C:\Python310\lib\pyclbr.py", line 120, in readmodule_ex
return _readmodule(module, path or [])
  File "C:\Python310\lib\pyclbr.py", line 159, in _readmodule
return _readmodule(submodule, parent['__path__'], package)
  File "C:\Python310\lib\pyclbr.py", line 184, in _readmodule
return _create_tree(fullmodule, path, fname, source, tree, inpackage)
  File "C:\Python310\lib\pyclbr.py", line 272, in _create_tree
mbrowser.visit(ast.parse(source))
  File "C:\Python310\lib\ast.py", line 410, in visit
return visitor(node)
  File "C:\Python310\lib\ast.py", line 418, in generic_visit
self.visit(item)
  File "C:\Python310\lib\ast.py", line 410, in visit
return visitor(node)
  File "C:\Python310\lib\pyclbr.py", line 243, in visit_Import
_readmodule(module.name, [])
  File "C:\Python310\lib\pyclbr.py", line 167, in _readmodule
spec = importlib.util._find_spec_from_path(fullmodule, search_path)
  File "C:\Python310\lib\importlib\util.py", line 69, in _find_spec_from_path
raise ValueError('{}.__spec__ is None'.format(name))
ValueError: __main__.__spec__ is None

--
components: Library (Lib)
messages: 387520
nosy: kxrob
priority: normal
severity: normal
status: open
title: pyclbr.readmodule_ex traversing "import __main__": dies with ValueError: 
__main__.__spec__ is None / is not set
type: crash
versions: Python 3.10

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33935] shutil.copyfile throws incorrect SameFileError on Google Drive File Stream

2021-02-22 Thread Eryk Sun


Eryk Sun  added the comment:

On second thought, I think it's cleaner and avoids potential race conditions to 
implement ntpath.sameopenfile(). Then use that to implement ntpath.samefile(). 
Here's a summary of suggested changes, with sample code to flesh out the 
concepts:

* Extend nt._getfinalpathname to support file descriptors via 
  _get_osfhandle(), and to support a flags parameter that defaults 
  to 0 (i.e. VOLUME_NAME_DOS | FILE_NAME_NORMALIZED).

* Add the constants VOLUME_NAME_NONE, VOLUME_NAME_NT, VOLUME_NAME_GUID, 
  and FILE_NAME_OPENED.

* Fix _winapi.CreateFile to link with CreateFileW instead of CreateFileA, 
  and add the constant FILE_FLAG_BACKUP_SEMANTICS.

* Implement ntpath.sameopenfile():

def _getfinalpathname_try_norm(file, flags):
flags &= ~_nt.FILE_NAME_OPENED
try:
return _getfinalpathname(file, flags)
except OSError as e:
#  1: ERROR_INVALID_FUNCTION
# 50: ERROR_NOT_SUPPORTED
# 87: ERROR_INVALID_PARAMETER
if e.winerror not in (1, 87, 50):
raise
# Try to resolve the path as opened, which may contain
# legacy 8.3 short names.
return _getfinalpathname(file, flags | _nt.FILE_NAME_OPENED)


def sameopenfile(fp1, fp2):
"""Test whether two open file objects reference the same file"""
s1 = os.fstat(fp1)
s2 = os.fstat(fp2)
if s1.st_ino != s2.st_ino or s1.st_dev != s2.st_dev:
return False
if s1.st_dev and s1.st_ino:
return True
# st_dev or st_ino is 0, e.g. both are 0 for a WebDAV filesystem.
# Compare the final paths instead.
if s1.st_dev or s1.st_ino:
# Get the final paths without the device name.
r1 = _getfinalpathname_try_norm(fp1, _nt.VOLUME_NAME_NONE)
r2 = _getfinalpathname_try_norm(fp2, _nt.VOLUME_NAME_NONE)
if s1.st_dev:
# st_dev is non-zero, so just compare these
# device-relative paths.
return r1 == r2
n1 = _getfinalpathname_try_norm(fp1, _nt.VOLUME_NAME_NT)
n2 = _getfinalpathname_try_norm(fp2, _nt.VOLUME_NAME_NT)
if s1.st_ino:
# st_ino is non-zero, so ignore the paths on the device(s),
# which could be different hardlink paths for the same file.
# Just compare the device names.
index1, index2 = n1.rfind(r1), n2.rfind(r2)
if index1 == -1 or index2 == -1:
# This should never happen, but never say never.
index1 = index2 = None
d1 = n1[:index1]
d2 = n2[:index2]
return d1 == d2
# st_dev and st_ino are both 0. Compare the full NT paths.
return n1 == n2

* Implement ntpath.samefile() via sameopenfile():

def samefile(fn1, fn2):
"""Test whether two file names reference the same file"""
# Open the files to avoid race conditions.
to_close = []
if not isinstance(fn1, int):
h = _winapi.CreateFile(
os.fsdecode(fn1), 0, 0, 0, _winapi.OPEN_EXISTING,
_winapi.FILE_FLAG_BACKUP_SEMANTICS, 0)
try:
fn1 = _msvcrt.open_osfhandle(h, 0)
except:
_winapi.CloseHandle(h)
raise
to_close.append(fn1)
try:
if not isinstance(fn2, int):
h = _winapi.CreateFile(
os.fsdecode(fn2), 0, 0, 0, _winapi.OPEN_EXISTING,
_winapi.FILE_FLAG_BACKUP_SEMANTICS, 0)
try:
fn2 = _msvcrt.open_osfhandle(h, 0)
except:
_winapi.CloseHandle(h)
raise
to_close.append(fn2)
return sameopenfile(fn1, fn2)
finally:
for fd in to_close:
os.close(fd)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43298] Windows build issue

2021-02-22 Thread STINNER Victor


Change by STINNER Victor :


--
nosy: +steve.dower

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43298] Windows build issue

2021-02-22 Thread Kevin Thomas


New submission from Kevin Thomas :

When compiling for Windows it does not properly handle the version string 
MSB4184

C:\Users\kevin\cpython>PCbuild\build.bat
Using py -3.7 (found 3.7 with py.exe)
Fetching external libraries...
bzip2-1.0.6 already exists, skipping.
sqlite-3.34.0.0 already exists, skipping.
xz-5.2.2 already exists, skipping.
zlib-1.2.11 already exists, skipping.
Fetching external binaries...
libffi already exists, skipping.
openssl-bin-1.1.1i already exists, skipping.
tcltk-8.6.10.0 already exists, skipping.
Finished.
Using "C:\Program Files (x86)\Microsoft Visual 
Studio\2019\Community\MSBuild\Current\Bin\msbuild.exe" (found in the Visual 
Studio installation)

C:\Users\kevin\cpython>"C:\Program Files (x86)\Microsoft Visual 
Studio\2019\Community\MSBuild\Current\Bin\msbuild.exe" 
"C:\Users\kevin\cpython\PCbuild\pcbuild.proj" /t:Build /m /nologo /v:m 
/clp:summary /p:Configuration=Release /p:Platform=x64 /p:IncludeExternals=true 
/p:IncludeCTypes=true /p:IncludeSSL=true /p:IncludeTkinter=true 
/p:UseTestMarker= /p:GIT="C:\Program Files\Git\cmd\git.exe"
C:\Users\kevin\cpython\PCbuild\python.props(111,31): error MSB4184: The 
expression "[System.Version]::Parse('')" cannot
 be evaluated. Version string portion was too short or too long. 
[C:\Users\kevin\cpython\PCbuild\pythoncore.vcxproj]

Build FAILED.

C:\Users\kevin\cpython\PCbuild\python.props(111,31): error MSB4184: The 
expression "[System.Version]::Parse('')" cannot
 be evaluated. Version string portion was too short or too long. 
[C:\Users\kevin\cpython\PCbuild\pythoncore.vcxproj]
0 Warning(s)
1 Error(s)

Time Elapsed 00:00:00.06

--
messages: 387518
nosy: mytechnotalent
priority: normal
severity: normal
status: open
title: Windows build issue
type: compile error
versions: Python 3.10

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43297] bz2.open modes behaving differently than standard open() modes

2021-02-22 Thread Philipp Freyer


New submission from Philipp Freyer :

The documentation clearly states that bz2.open(mode='r') opens a file in binary 
mode. I would have to use 'rt' for text mode.

The basic Python open(mode='r') method opens a file in text mode.
This is how I would expect any open(mode='r') method to work, especially since 
the standard Python implementation of open() treats 'r' as a synonym to 'rt'.

IMHO the behavior of bz2.open() is a possible pitfall for many developers and 
should be in line with the standard open() behavior.

Sorry, if this is in the wrong place, I am happy to put this elsewhere. 
However, I do see that as a conceptual issue (in our case this bug was not 
found for years)

--
messages: 387517
nosy: philipp.freyer
priority: normal
severity: normal
status: open
title: bz2.open modes behaving differently than standard open() modes
type: behavior
versions: Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43295] datetime.strptime emits IndexError on parsing 'z' as %z

2021-02-22 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +belopolsky, p-ganssle

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43296] [sqlite3] sqlite3_value_bytes() should be called after sqlite3_value_blob()

2021-02-22 Thread Erlend Egeberg Aasland


New submission from Erlend Egeberg Aasland :

The sqlite3_value_*() API is almost identical to the sqlite3_column_*() API. 
sqlite3_value_bytes() should be called after we've converted the value using 
sqlite3_value_blob().

See also bpo-43249.

--
components: Library (Lib)
messages: 387516
nosy: berker.peksag, erlendaasland, serhiy.storchaka
priority: normal
severity: normal
status: open
title: [sqlite3] sqlite3_value_bytes() should be called after 
sqlite3_value_blob()
type: behavior
versions: Python 3.10

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1152248] Add support for reading records with arbitrary separators to the standard IO stack

2021-02-22 Thread Christoph Anton Mitterer


Christoph Anton Mitterer  added the comment:

Oh, what a pity,... 

Seemed like a pretty common use case, which is unnecessarily prone to buggy or 
inefficient (user-)implementations.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41975] Textwrap to conform to https://www.unicode.org/reports/tr14/tr14-45.html

2021-02-22 Thread Борис Верховский

Change by Борис Верховский :


--
nosy: +boris

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43295] datetime.strptime emits IndexError on parsing 'z' as %z

2021-02-22 Thread itchyny


New submission from itchyny :

In Python 3.9.2, parsing 'z' (small letter) as '%z' (time zone offset) using 
datetime.strptime emits an IndexError.

>>> from datetime import datetime
>>> datetime.strptime('z', '%z')
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/local/lib/python3.9/_strptime.py", line 568, in _strptime_datetime
tt, fraction, gmtoff_fraction = _strptime(data_string, format)
  File "/usr/local/lib/python3.9/_strptime.py", line 453, in _strptime
if z[3] == ':':
IndexError: string index out of range

I expect ValueError (or some another useful error) as follows.
ValueError: time data 'z' does not match format '%z'

This is caused by compiling '%z' to a pattern containing 'Z' (for UTC) with the 
IGNORECASE flag and accessing z[3] without noticing 'z' is accepted by the 
regexp.

--
components: Library (Lib)
messages: 387514
nosy: itchyny
priority: normal
severity: normal
status: open
title: datetime.strptime emits IndexError on parsing 'z' as %z
type: behavior
versions: Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36346] Prepare for removing the legacy Unicode C API

2021-02-22 Thread Inada Naoki


Inada Naoki  added the comment:


New changeset 91a639a094978882caef91915c932fbb2fc347de by Inada Naoki in branch 
'master':
bpo-36346: Emit DeprecationWarning for PyArg_Parse() with 'u' or 'Z'. (GH-20927)
https://github.com/python/cpython/commit/91a639a094978882caef91915c932fbb2fc347de


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43250] [C API] Deprecate or remove PyFPE_START_PROTECT() and PyFPE_END_PROTECT()

2021-02-22 Thread Dong-hee Na


Change by Dong-hee Na :


--
nosy: +corona10

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1152248] Add support for reading records with arbitrary separators to the standard IO stack

2021-02-22 Thread Antoine Pitrou


Change by Antoine Pitrou :


--
resolution:  -> later
stage: needs patch -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1152248] Add support for reading records with arbitrary separators to the standard IO stack

2021-02-22 Thread Antoine Pitrou


Antoine Pitrou  added the comment:

I don't think so.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26600] Thread safety issue with MagickMock __str__: sometimes returns MagickMock instead of str

2021-02-22 Thread Irit Katriel


Change by Irit Katriel :


--
resolution: not a bug -> 
title: MagickMock __str__ sometimes returns MagickMock instead of str -> Thread 
safety issue with MagickMock __str__: sometimes returns MagickMock instead of 
str

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26600] MagickMock __str__ sometimes returns MagickMock instead of str

2021-02-22 Thread Uosiu

Stanisław Skonieczny (Uosiu)  added the comment:

When you just create a magick mock and then call `__str__` on it, it never
throws an exception and always return a string.
But... when you create a magick mock and then call `__str__` from two
threads concurrently, one of them will raise an exception.

Race is as follows:
1. Thread 1 creates magick mock m.
2. Thread 1 enters `m.__str__` it starts some internal preparations. It
does not exit `__str__` yet.
3. Thread 2 enters `m.__str__`.
In effect one of this threads will try to return `MagickMock` instance
instead of `str` object, which if forbidden by python.
Some low-level python check will raise following exception: `TypeError:
__str__ returned non-string (type MagicMock)`.

Stanisław Skonieczny

On Mon, Feb 22, 2021 at 10:56 AM Irit Katriel 
wrote:

>
> Irit Katriel  added the comment:
>
> Why is this only relevant to multiple thread?
>
> --
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43294] [sqlite3] unused variables in Connection begin, commit, and rollback

2021-02-22 Thread Erlend Egeberg Aasland


New submission from Erlend Egeberg Aasland :

In Modules/_sqlite/connection.c:
pysqlite_connection_commit_impl(), pysqlite_connection_rollback_impl(), and 
_pysqlite_connection_begin() all call sqlite3_prepare_v2() with the fourth 
parameter (pzTail) set. This (output) parameter is never used, we can safely 
remove the tail variables, and just call sqlite3_prepare_v2() with NULL as the 
fourth parameter.


Also, there's a lot of code duplication here. A support function could help 
simplify this, but that's out of scope.

--
components: Library (Lib)
messages: 387510
nosy: berker.peksag, erlendaasland, serhiy.storchaka
priority: normal
severity: normal
status: open
title: [sqlite3] unused variables in Connection begin, commit, and rollback
type: enhancement
versions: Python 3.10

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26600] MagickMock __str__ sometimes returns MagickMock instead of str

2021-02-22 Thread Irit Katriel


Irit Katriel  added the comment:

Why is this only relevant to multiple thread?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26600] MagickMock __str__ sometimes returns MagickMock instead of str

2021-02-22 Thread Irit Katriel


Change by Irit Katriel :


--
status: closed -> open

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43289] step bug in turtle's for loop

2021-02-22 Thread Yehuda Katz


Yehuda Katz  added the comment:

Thank you Dennis for taking the time to answer.
Yehuda


Virus-free.
www.avg.com

<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

On Mon, Feb 22, 2021 at 3:21 AM Dennis Sweeney 
wrote:

>
> Dennis Sweeney  added the comment:
>
> If I understand correctly, changing the -1 to a -2 does not actually make
> the program "crash" -- you just only see one black circle.
>
> The reason is that range(40, 0, -2) produces 40, 38, 36, etc., all of
> which are even numbers, so rad % 2 is always 0, so col[rad % 2] is always
> "black". You could try:
>
> for index, rad in enumerate(range(40, 0, -2)):
> dot(5*rad, col[index % 2])
>
> In the future, I would suggest asking questions like this on
> StackOverflow, since this is not a bug in Python itself.
>
> --
> nosy: +Dennis Sweeney
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26600] MagickMock __str__ sometimes returns MagickMock instead of str

2021-02-22 Thread Uosiu

Stanisław Skonieczny (Uosiu)  added the comment:

However there is still nothing in the docs that you have to mock `__str__`
by yourself
when using mock object with multiple threads. Otherwise calling `__str__`
may result
with raising exception if you are unlucky.

Stanisław Skonieczny

On Wed, Feb 17, 2021 at 7:26 PM Irit Katriel  wrote:

>
> Irit Katriel  added the comment:
>
> The documentation has examples how to set up a mock's __str__.
>
> https://docs.python.org/3/library/unittest.mock.html
>
> --
> nosy: +iritkatriel
> resolution:  -> not a bug
> stage:  -> resolved
> status: open -> closed
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15108] Incomplete tuple created by PyTuple_New() and accessed via the GC can trigged a crash

2021-02-22 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

I mainly agree on closing this issue as we already have a warning about this 
behaviour in gc.get_referrers and other friends.

On the other hand I am still a bit afraid of a crash that could happen if the 
GC does a pass and one of these tuples is in an inconsistent state. Is possible 
that this crashes Python without the user calling ever any function from the GC 
module. I need to do some investigation around this, but I agree that this is a 
separate issue, so I will open a new one if it happens to be relevant.

--
resolution:  -> not a bug
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24275] lookdict_* give up too soon

2021-02-22 Thread Inada Naoki


Inada Naoki  added the comment:

I'm +1 for this. Would you create a pull request on GitHub?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23882] unittest discovery doesn't detect namespace packages when given no parameters

2021-02-22 Thread Inada Naoki


Change by Inada Naoki :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.8, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com