[issue41453] A possible reference leak in _locale.localeconv()

2020-07-31 Thread Zackery Spytz


Change by Zackery Spytz :


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

___
Python tracker 

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



[issue41330] Inefficient error-handle for CJK encodings

2020-07-31 Thread Ma Lin


Ma Lin  added the comment:

At least fix this bug:

the error-handler object is not cached, it needs to be
looked up from a dict every time, which is very inefficient.

The code:
https://github.com/python/cpython/blob/v3.9.0b4/Modules/cjkcodecs/multibytecodec.c#L81-L98

I will submit a PR at some point.

--

___
Python tracker 

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



[issue41453] A possible reference leak in _locale.localeconv()

2020-07-31 Thread Zackery Spytz


New submission from Zackery Spytz :

If the _Py_GetLocaleconvNumeric() call fails in _locale_localeconv_impl(),
"decimal_point" may be leaked.

--
components: Extension Modules
messages: 374655
nosy: ZackerySpytz
priority: normal
severity: normal
status: open
title: A possible reference leak in _locale.localeconv()
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



[issue41452] Inefficient BufferedReader.read(-1)

2020-07-31 Thread Ma Lin


Change by Ma Lin :


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

___
Python tracker 

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



[issue41451] Cannot subclass typing.Generic with __weakref__ slot in Python 3.6

2020-07-31 Thread Joshua Oreman


Joshua Oreman  added the comment:

The problem appears to be occurring when the base class is subscripted, not 
when it's inherited. I can reproduce this issue on Python 3.6.10 by just 
evaluating Base[T].

'del Base.__slots__' after Base is constructed seems to work around the issue, 
and allow Base[T] to be evaluated. Of course, Base is still slotted at this 
point, since __slots__ are consulted only when initially building the class.

--
nosy: +Joshua Oreman

___
Python tracker 

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



[issue41451] Cannot subclass typing.Generic with __weakref__ slot in Python 3.6

2020-07-31 Thread Joshua Bronson


Joshua Bronson  added the comment:

Whittled this down to an even more minimal repro:


"""Repro for Python 3.6 slots + weakref + typing.Generic subclass bug."""

from typing import Generic, TypeVar
from weakref import ref


T = TypeVar("T")

class MyGeneric(Generic[T]):
"""MyGeneric works as expected.

>>> example = MyGeneric()
>>> from pickle import dumps, loads
>>> pickled = dumps(example)
>>> roundtripped = loads(pickled)
>>> roundtripped
<__main__.MyGeneric object at ...>

"""

__slots__ = ("_other", "__weakref__")

def __init__(self) -> None:
self._init_other()

def _init_other(self) -> None:
other = self.__class__.__new__(self.__class__)
other._other = self
self._other = ref(other)

def __getstate__(self) -> dict:
"""Needed to enable pickling due to use of __slots__ and weakrefs."""
return {}

def __setstate__(self, _) -> None:
"""Needed because use of __slots__ would prevent unpickling 
otherwise."""
self._init_other()


# So far so good, but now let's make a subclass.
# The following class definition works on Python > 3.6, but fails on 3.6 with
# TypeError: __weakref__ slot disallowed: either we already got one, or 
__itemsize__ != 0
class FailsInPy36(MyGeneric[T]):
"""Minimal repro.

>>> repro = FailsInPy36()
>>> repro
<__main__.FailsInPy36 object at ...>

"""


if __name__ == "__main__":
import doctest
doctest.testmod(optionflags=doctest.ELLIPSIS)

--
title: Class with __weakref__ slot cannot inherit from typing.Generic subclass 
-> Cannot subclass typing.Generic with __weakref__ slot in Python 3.6
Added file: https://bugs.python.org/file49355/bpo41451-repro-min.py

___
Python tracker 

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



[issue41452] Inefficient BufferedReader.read(-1)

2020-07-31 Thread Ma Lin


New submission from Ma Lin :

BufferedReader's constructor has a `buffer_size` parameter, it's the size of 
this buffer:

When reading data from BufferedReader object, a larger
amount of data may be requested from the underlying raw
stream, and kept in an internal buffer.

The doc of BufferedReader[1]


If call the BufferedReader.read(size) function:

1, When `size` is a positive number, it reads `buffer_size`
   bytes from the underlying stream. This is expected behavior.

2, When `size` is -1, it tries to call underlying stream's
   readall() function [2]. In this case `buffer_size` is not
   be respected.
   
   The underlying stream may be `RawIOBase`, its readall()
   function read `DEFAULT_BUFFER_SIZE` bytes in each read [3].
   
   `DEFAULT_BUFFER_SIZE` currently only 8KB, which is very
   inefficient for BufferedReader.read(-1). If `buffer_size`
   bytes is read every time, will be the expected performance.

Attached file demonstrates this problem.


[1] doc of BufferedReader:
https://docs.python.org/3/library/io.html#io.BufferedReader

[2] BufferedReader.read(-1) tries to call underlying stream's readall() 
function:
https://github.com/python/cpython/blob/v3.9.0b5/Modules/_io/bufferedio.c#L1538-L1542

[3] RawIOBase.readall() read DEFAULT_BUFFER_SIZE each time:
https://github.com/python/cpython/blob/v3.9.0b5/Modules/_io/iobase.c#L968-L969

--
components: IO
files: demo.py
messages: 374652
nosy: malin
priority: normal
severity: normal
status: open
title: Inefficient BufferedReader.read(-1)
type: performance
versions: Python 3.10
Added file: https://bugs.python.org/file49354/demo.py

___
Python tracker 

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



[issue41450] OSError is not documented in ssl library, but still can be thrown

2020-07-31 Thread Martin Panter


Martin Panter  added the comment:

Issue 31122 is also open about fixing this long-term, but I agree it would be 
good to document this quirk / bug.

--
nosy: +martin.panter

___
Python tracker 

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



[issue41451] Class with __weakref__ slot cannot inherit from typing.Generic subclass

2020-07-31 Thread Joshua Bronson


Joshua Bronson  added the comment:

It turns out that this bug reproduces with any subclass of the generic type 
with a weakref slot, even without any multiple inheritance going on.

For example:

class Invertible2(Invertible[KT1, KT2]): pass

is enough to trigger this bug along with the Invertible class in my previous 
example. Attaching the more minimal repro with this comment, and renaming the 
issue to remove the reference to multiple inheritance.

--
title: Class with __weakref__ slot cannot inherit from multiple typing.Generic 
classes -> Class with __weakref__ slot cannot inherit from typing.Generic 
subclass
Added file: https://bugs.python.org/file49353/bpo41451-repro.py

___
Python tracker 

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



[issue41451] Class with __weakref__ slot cannot inherit from multiple typing.Generic classes

2020-07-31 Thread Joshua Bronson


New submission from Joshua Bronson :

This appears to be a bug in Python 3.6 that I hit while trying to add type 
hints to my bidirectional mapping library (https://bidict.rtfd.io).

Pasting a working, minimal repro below for easier inline viewing, and also 
attaching for easier downloading and running.

Please let me know if there is a workaround that would allow me to continue to 
support Python 3.6 after adding type hints without having to remove the use of 
slots and weak references. I spent a while trying to find one first but was 
then encouraged to report this by @ethanhs.

Thanks in advance for any pointers you may have.

#!/usr/bin/env python3
"""Repro for Python 3.6 slots + weakref + typing.Generic bug."""

from typing import Iterator, Mapping, MutableMapping, TypeVar
from weakref import ref


KT1 = TypeVar("KT1")
KT2 = TypeVar("KT2")


class Invertible(Mapping[KT1, KT2]):
"""A one-element mapping that is generic in two key types with a reference 
to its inverse.

...which in turn holds a (weak) reference back to it.

>>> element = Invertible("H", 1)
>>> element

>>> element.inverse

>>> element.inverse.inverse

>>> element.inverse.inverse is element
True

>>> dict(element.items())
{'H': 1}
>>> dict(element.inverse.items())
{1: 'H'}
>>> list(element)
['H']

Uses the __slots__ optimization, and uses weakrefs for references in one 
direction
to avoid strong reference cycles. And still manages to support pickling to 
boot!

>>> from pickle import dumps, loads
>>> pickled = dumps(element)
>>> roundtripped = loads(pickled)
>>> roundtripped


"""

# Each instance has (either a strong or a weak) reference to its
# inverse instance, which has a (weak or strong) reference back.
__slots__ = ("_inverse_strong", "_inverse_weak", "__weakref__", "key1", 
"key2")

def __init__(self, key1: KT1, key2: KT2) -> None:
self._inverse_weak = None
self._inverse_strong = inverse = self.__class__.__new__(self.__class__)
self.key1 = inverse.key2 = key1
self.key2 = inverse.key1 = key2
inverse._inverse_strong = None
inverse._inverse_weak = ref(self)

def __len__(self) -> int:
return 1

def __iter__(self) -> Iterator[KT1]:
yield self.key1

def __getitem__(self, key: KT1) -> KT2:
if key == self.key1:
return self.key2
raise KeyError(key)

def __repr__(self) -> str:
return f"<{self.__class__.__name__} key1={self.key1!r} 
key2={self.key2!r}>"

@property
def inverse(self) -> "Invertible[KT2, KT1]":
"""The inverse instance."""
if self._inverse_strong is not None:
return self._inverse_strong
inverse = self._inverse_weak()
if inverse is not None:
return inverse
# Refcount of referent must have dropped to zero,
# as in `Invertible().inverse.inverse`, so init a new one.
self._inverse_weak = None
self._inverse_strong = inverse = self.__class__.__new__(self.__class__)
inverse.key2 = self.key1
inverse.key1 = self.key2
inverse._inverse_strong = None
inverse._inverse_weak = ref(self)
return inverse

def __getstate__(self) -> dict:
"""Needed to enable pickling due to use of __slots__ and weakrefs."""
state = {}
for cls in self.__class__.__mro__:
slots = getattr(cls, '__slots__', ())
for slot in slots:
if hasattr(self, slot):
state[slot] = getattr(self, slot)
# weakrefs can't be pickled.
state.pop('_inverse_weak', None)  # Added back in __setstate__ below.
state.pop('__weakref__', None)  # Not added back in __setstate__. 
Python manages this one.
return state

def __setstate__(self, state) -> None:
"""Needed because use of __slots__ would prevent unpickling 
otherwise."""
for slot, value in state.items():
setattr(self, slot, value)
self._inverse_weak = None
self._inverse_strong = inverse = self.__class__.__new__(self.__class__)
inverse.key2 = self.key1
inverse.key1 = self.key2
inverse._inverse_strong = None
inverse._inverse_weak = ref(self)


# So far so good, but now let's make a mutable version.
# 
# The following class definition works on Python > 3.6, but fails on 3.6 with
# TypeError: __weakref__ slot disallowed: either we already got one, or 
__itemsize__ != 0

class MutableInvertible(Invertible[KT1, KT2], MutableMapping[KT1, KT2]):
"""Works on > 3.6, but we don't even get this far on Python 3.6:

>>> MutableInvertible("H", 1)


"""

__slots__ = ()

def __setitem__(self, key1: KT1, key2: KT2) -> None:
self.key1 = self.inverse.key2 = key1
self.key2 = 

[issue26791] shutil.move fails to move symlink (Invalid cross-device link)

2020-07-31 Thread SilentGhost


Change by SilentGhost :


--
nosy:  -SilentGhost

___
Python tracker 

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



[issue26791] shutil.move fails to move symlink (Invalid cross-device link)

2020-07-31 Thread Murray Wilson


Murray Wilson  added the comment:

It also happens when moving a file in linux from an xfs filesystem to a NFS 
mounted filesystem.

--
nosy: +Murray Wilson

___
Python tracker 

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



[issue40978] Document that typing.SupportsXXX protocols are runtime checkable

2020-07-31 Thread Guido van Rossum


Guido van Rossum  added the comment:

I agree with Luciano's conclusion and have nothing to add other than to
encourage him to submit a PR for the docs. (I know he already submitted a
PR to refactor the docs. Honestly I lost track of that one. Luciano, if you
need my review for that one, please ping me.)

On Fri, Jul 31, 2020 at 10:04 AM Mariatta  wrote:

>
> Mariatta  added the comment:
>
> >  because their runtime results are inconsistent with how Mypy handles
> them, producing both false positives and false negatives.
>
> @guido or @ivan, do you have further thoughts or additional context to
> share about the above point?
>
> --
> nosy: +Mariatta
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue40978] Document that typing.SupportsXXX protocols are runtime checkable

2020-07-31 Thread Mariatta


Mariatta  added the comment:

>  because their runtime results are inconsistent with how Mypy handles them, 
> producing both false positives and false negatives.

@guido or @ivan, do you have further thoughts or additional context to share 
about the above point?

--
nosy: +Mariatta

___
Python tracker 

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



[issue40666] TarFile.add does not support pathlib.Path as a value to first argument.

2020-07-31 Thread Akuli


New submission from Akuli :

TarFile.add seems to support pathlib.Path objects (and other PathLike string 
paths) starting at Python 3.6, for both name and arcname. The paths go to 
`os.path` functions that return strings.

Recently typeshed was updated to support passing pathlib.Paths in TarFile.add: 
https://github.com/python/typeshed/pull/4369

--
nosy: +Akuli

___
Python tracker 

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



[issue34277] EmailPolicy not followed

2020-07-31 Thread Bryce Drennan


Change by Bryce Drennan :


Removed file: https://bugs.python.org/file47720/test_header_folding.py

___
Python tracker 

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



[issue41450] OSError is not documented in ssl library, but still can be thrown

2020-07-31 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +christian.heimes

___
Python tracker 

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



[issue41450] OSError is not documented in ssl library, but still can be thrown

2020-07-31 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
components: +SSL

___
Python tracker 

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



[issue41450] OSError is not documented in ssl library, but still can be thrown

2020-07-31 Thread Alexander Sibiryakov


New submission from Alexander Sibiryakov :

See stack trace
[07/15/2020 08:51:14.799: ERROR/kafka.producer.sender] Uncaught error in kafka 
producer I/O thread
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/kafka/producer/sender.py", line 
60, in run
self.run_once()
File "/usr/local/lib/python3.6/site-packages/kafka/producer/sender.py", line 
160, in run_once
self._client.poll(timeout_ms=poll_timeout_ms)
File "/usr/local/lib/python3.6/site-packages/kafka/client_async.py", line 580, 
in poll
self._maybe_connect(node_id)
File "/usr/local/lib/python3.6/site-packages/kafka/client_async.py", line 390, 
in _maybe_connect
conn.connect()
File "/usr/local/lib/python3.6/site-packages/kafka/conn.py", line 426, in 
connect
if self._try_handshake():
File "/usr/local/lib/python3.6/site-packages/kafka/conn.py", line 505, in 
_try_handshake
self._sock.do_handshake()
File "/usr/local/lib/python3.6/ssl.py", line 1077, in do_handshake
self._sslobj.do_handshake()
File "/usr/local/lib/python3.6/ssl.py", line 689, in do_handshake
self._sslobj.do_handshake()
OSError: [Errno 0] Error

See docs
https://docs.python.org/3.8/library/ssl.html

and see source code:
https://github.com/python/cpython/blob/3.8/Modules/_ssl.c

Probably the best would be to proceed with using SSLError, but short term 
OSError could be documented.

--
assignee: docs@python
components: Documentation
messages: 374644
nosy: docs@python, sibiryakov
priority: normal
severity: normal
status: open
title: OSError is not documented in ssl library, but still can be thrown
type: behavior
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



[issue41448] pathlib behave differ between OS

2020-07-31 Thread Eryk Sun


Change by Eryk Sun :


--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> pathlib.Path.resolve(strict=False) returns relative path on 
Windows if the entry does not exist

___
Python tracker 

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



[issue40360] Deprecate lib2to3 (and 2to3) for future removal

2020-07-31 Thread Guido van Rossum


Guido van Rossum  added the comment:


New changeset fe928b32daca184e16ccc0ebdc20314cfa776b98 by Karthikeyan 
Singaravelan in branch '3.9':
[3.9] bpo-40360: Handle PendingDeprecationWarning in test_lib2to3. (GH-21694) 
(GH-21697)
https://github.com/python/cpython/commit/fe928b32daca184e16ccc0ebdc20314cfa776b98


--

___
Python tracker 

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



[issue36207] robotsparser deny all with some rules

2020-07-31 Thread Arnaud LIPERINI-DIAZ


Arnaud LIPERINI-DIAZ  added the comment:

Do you have documentation about robotParser ? The robot.txt of this website 
works fine : https://vauros.com/

--
nosy: +Arnaud LIPERINI-DIAZ

___
Python tracker 

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



[issue41402] email: ContentManager.set_content calls nonexistent method encode() on bytes

2020-07-31 Thread R. David Murray


R. David Murray  added the comment:

The fix looks good to me.  Don't know how I made that mistake, and obviously I 
didn't write a test for it...

--

___
Python tracker 

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



[issue41448] pathlib behave differ between OS

2020-07-31 Thread Mond Wan


Mond Wan  added the comment:

Thanks for the clarifications on PurePosixPath(). Now, I know which library I 
should use to solve my problem.

For resolve() with strict True, I have tried on both platform. They will both 
raise exception if that file does not exists.

--

___
Python tracker 

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



[issue41448] pathlib behave differ between OS

2020-07-31 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

PureWindowsPath does not know about POSIX paths, it supports the two styles of 
directory separator that are valid on Windows: '/' and '\'. 

PurePosixPath only supports the single stile of directory separator valid on 
POSIX systems: '/'. 

On a Posix system backslash is a valid character in a file name and is NOT a 
directory separator.


The behaviour of Path.resolve() on Windows may or may not be a bug, the 
documentation is not quite clear. Personally I'd lean toward saying this is a 
bug, but I defer to a pathlib expert.  Note that path.resolve(strict=True) 
should raise an error on both platforms when the path does not exists.

--

___
Python tracker 

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



[issue41448] pathlib behave differ between OS

2020-07-31 Thread Mond Wan


Mond Wan  added the comment:

Moreover, output from PurePosixPath.as_posix() is not that straightforward?

Please take a look below example from python3.6 + linux + docker

```
>>> winPath = r'\workspace\xxx\test_fixture\user-restore-success.zip'

>>> pWIN = pathlib.PureWindowsPath(winPath)
>>> pppFromWinPath = pathlib.PurePosixPath(winPath)
>>> pppFromPwp = pathlib.PurePosixPath(pWIN)

>>> pppFromWinPath.as_posix()
'\\workspace\\xxx\\test_fixture\\user-restore-success.zip'
>>> pppFromPwp.as_posix()
'\\/workspace/xxx/test_fixture/user-restore-success.zip'
```

* Construction PurePosixPath from rawString, `as_posix()` gives 
'\\workspace\\xxx\\test_fixture\\user-restore-success.zip'
* Construction PurePosixPath from PureWindowsPath, `as_posix()` gives 
'\\/workspace/xxx/test_fixture/user-restore-success.zip'

--

___
Python tracker 

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



[issue41448] pathlib behave differ between OS

2020-07-31 Thread Mond Wan


Mond Wan  added the comment:

Let me clarify my expectation.

# For `as_posix()`

* PureWindowsPath can translate both POSIX path, and WINDOW path to POSIX path 
via `as_posix()`
* Therefore, I expect PurePosixPath can translate both platform path to 
POSIX path via `as_posix()`

* I just tried PurePosixPath() behave same between Window, and the docker.
* I am sorry for showing misleading information

# For `resolve()`

* In window platform, resolve() returns absolute path only if such file is able 
to locate. Otherwise, it returns
relative path.

* In Linux platform, resolve() returns absolute path anyway

--

___
Python tracker 

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



[issue40360] Deprecate lib2to3 (and 2to3) for future removal

2020-07-31 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
pull_requests: +20841
pull_request: https://github.com/python/cpython/pull/21697

___
Python tracker 

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



[issue37586] macOS: posix_spawn(..., setsid=True)

2020-07-31 Thread Ned Deily


Ned Deily  added the comment:

The immediate problem is that the version of Xcode you are using supplies a 
MacOSX10.15 SDK by default. Since you are running on 10.14, the test passes if 
you build using a MacOSX10.14 SDK. Either upgrade to 10.15 or grab the 10.14 
SDK from a previous version of Xcode or the Command Line Tools (which is all 
you need to build and test Python) and make that SDK the default.  Ronald's 
patch will eventually fix that but, unless you are building for a newer OS 
version on an older OS version, it is still safest to use the SDK version that 
corresponds to the running system.

--

___
Python tracker 

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



[issue41448] pathlib behave differ between OS

2020-07-31 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

I'm not sure what you try to report.

PurePath(...) returns a PureWindowsPath on Windows and an PurePosixPath on 
other (unix-y) platforms. This explains the difference in behaviour you're 
seeing for as_posix().

--

___
Python tracker 

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



[issue40360] Deprecate lib2to3 (and 2to3) for future removal

2020-07-31 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:


New changeset cadda52d974937069eeebea1cca4229e2bd400df by Karthikeyan 
Singaravelan in branch 'master':
bpo-40360: Handle PendingDeprecationWarning in test_lib2to3. (GH-21694)
https://github.com/python/cpython/commit/cadda52d974937069eeebea1cca4229e2bd400df


--

___
Python tracker 

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



[issue40360] Deprecate lib2to3 (and 2to3) for future removal

2020-07-31 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 10.0 -> 11.0
pull_requests: +20840
pull_request: https://github.com/python/cpython/pull/21696

___
Python tracker 

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



[issue41449] An article on Python 3 stdout and stderr output buffering

2020-07-31 Thread Anatoli Babenia


New submission from Anatoli Babenia :

It is hard to find info why Python 3 buffers stdout/stderr. The buffering 
causes problems when debugging Python apps in Docker and Kubernetes, and it is 
unclear if it is Python 3 who starts to buffer stdout if no tty is attached, it 
is Docker, or it is Kubernetes.

The only bit of info that could be searched is the description of -u option 
https://docs.python.org/3.8/using/cmdline.html?#cmdoption-u which is not linked 
to any article.

The `-u` description also says.

> Changed in version 3.7: The text layer of the stdout and stderr streams now 
> is unbuffered.

However, I don't understand what is the text layers of stdout. And there is no 
description of behaviour when the output is not attached, and when the output 
is redirected.

--
assignee: docs@python
components: Documentation
messages: 374633
nosy: Anatoli Babenia, docs@python
priority: normal
severity: normal
status: open
title: An article on Python 3 stdout and stderr output buffering

___
Python tracker 

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



[issue41448] pathlib behave differ between OS

2020-07-31 Thread Mond Wan


Change by Mond Wan :


--
type:  -> behavior

___
Python tracker 

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



[issue41448] pathlib behave differ between OS

2020-07-31 Thread Mond Wan


New submission from Mond Wan :

I have tried 2 functions with different behavior across platform

# as_posix()

In linux platform, as_posix() cannot process window path nicely

* From linux + docker + python:3.8

```
Python 3.8.0 (default, Oct 17 2019, 05:36:36)
[GCC 8.3.0] on linux

>>> winPath = r'\workspace\xxx\test_fixture\user-restore-success.zip'
>>> posixPath = '/workspace/xxx/test_fixture/user-restore-success.zip'
>>> pWIN = pathlib.PurePath(winPath)
>>> pPOSIX = pathlib.PurePath(posixPath)
>>> pWIN.as_posix()
'\\workspace\\xxx\\test_fixture\\user-restore-success.zip'
>>> pPOSIX.as_posix()
'/workspace/xxx/test_fixture/user-restore-success.zip'
```

* From window + powershell + python3.6

```
Python 3.6.8 (tags/v3.6.8:3c6b436a57, Dec 24 2018, 00:16:47) [MSC v.1916 64 bit 
(AMD64)] on win32

>>> winPath = r'\workspace\xxx\test_fixture\user-restore-success.zip'
>>> posixPath = '/workspace/xxx/test_fixture/user-restore-success.zip'
>>> pWIN = pathlib.PurePath(winPath)
>>> pPOSIX = pathlib.PurePath(posixPath)
>>> pWIN.as_posix()
'/workspace/xxx/test_fixture/user-restore-success.zip'
>>> pPOSIX.as_posix()
'/workspace/xxx/test_fixture/user-restore-success.zip'

```

* From MAC

```
>>> winPath = '\\workspace\\xxx\\test_fixture\\user-restore-success.zip'
>>> posixPath = '/workspace/xxx/test_fixture/user-restore-success.zip'
>>> pWIN = pathlib.PurePath(winPath)
>>> pPOSIX = pathlib.PurePath(posixPath)
>>> pWIN.as_posix()
'\\workspace\\xxx\\test_fixture\\user-restore-success.zip'
>>> pPOSIX.as_posix()
'/workspace/xxx/test_fixture/user-restore-success.zip'
```

# resolve()

In window platform, resolve() returns absolute path only if such file is able 
to locate. Otherwise, it returns
relative path.

In Linux platform, resolve() returns absolute path anyway

* From linux

```
root@b4f03ed3003b:/var/run/lock# python
Python 3.8.0 (default, Oct 17 2019, 05:36:36)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pathlib
>>> p = pathlib.Path('no_exists')
>>> p.resolve()
PosixPath('/run/lock/no_exists')
>>> str(p.resolve())
'/run/lock/no_exits'

```

* From window

```
Python 3.6.8 (tags/v3.6.8:3c6b436a57, Dec 24 2018, 00:16:47) [MSC v.1916 64 bit 
(AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pathlib
>>> p = pathlib.Path('README.md')
>>> p.resolve()
WindowsPath('C:/Users/xxx/PycharmProjects/yyy/README.md')
>>> str(p.resolve())
'C:\\Users\\xxx\\PycharmProjects\\yyy\\README.md'
>>> p = pathlib.Path('no_exists')
>>> p.resolve()
WindowsPath('no_exists')
>>> str(p.resolve())
'no_exists'

```

Also, I have spotted a ticket similar to this one

https://bugs.python.org/issue41357

--
components: FreeBSD, Windows, macOS
messages: 374632
nosy: Mond Wan, koobs, ned.deily, paul.moore, ronaldoussoren, steve.dower, 
tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: pathlib behave differ between OS
versions: Python 3.6, 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



[issue41421] Random.paretovariate sometimes raises ZeroDivisionError for small alpha

2020-07-31 Thread Raymond Hettinger


Change by Raymond Hettinger :


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

___
Python tracker 

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



[issue41177] ConvertingList and ConvertingTuple lack iterators and ConvertingDict lacks items()

2020-07-31 Thread Vinay Sajip


Vinay Sajip  added the comment:

Thanks for the PR. I reviewed it and requested changes about 3 weeks ago - you 
should have received a notification from GitHub when that happened.

--

___
Python tracker 

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



[issue41445] Adding configure temporary files to gitignore

2020-07-31 Thread Inada Naoki


Inada Naoki  added the comment:

Do you know you can use separated build dir?

```
$ mkdir build
$ cd build
$ ../configure --with-pydebug
```

--
nosy: +inada.naoki

___
Python tracker 

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