[issue47030] singledispatch does not work with positional arguments with default values.

2022-03-21 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

This would be problematic for two reasons:

 - possible confusion between the default function that runs when an argument 
doesn't match any registered types, and another "default" which runs when 
argument is omitted.

 - to see which function will run when argument is omitted, you would need to 
check in two places - the default value of arg and then find the registered 
function that matches it. If we end up deciding there is a need to run a 
default handler when an argument is omitted, it would be more explicit and 
convenient and visually obvious to decorate the "default if no arg" handler in 
some way, which also means there'd be a single place where this behavior is 
defined.

We can also consider adding a note to documentation that the first argument 
used for dispatch should not have a default value, to make it more explicit 
that dispatching on default value is not supported.

--
nosy: +andrei.avk

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



[issue47026] BytesWarning in zipimport paths on sys.path

2022-03-20 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

This warning can be fixed by changing the following line:

https://github.com/python/cpython/blob/9d1c4d69dbc800ac344565119337fcf490cdc800/Lib/importlib/_bootstrap_external.py#L1419

to:

if not path and str(path) == '':

and running `make regen-importlib; make`

Alternatively the change can be:

if not path and isinstance(path, (str,bytes)):

I'm not sure which is preferable or if some other fix would be better (I don't 
know much about importlib).

===
Adding Brett as the expert -- Brett, can you take a look?

Adding a full traceback with -bb argument:

Traceback (most recent call last):
  File "/Users/ak/temp2/zipfile_demo.py", line 29, in 
sys.exit(main())
 ^^
  File "/Users/ak/opensource/cpython4/Lib/contextlib.py", line 155, in __exit__
self.gen.throw(typ, value, traceback)
^
  File "/Users/ak/temp2/zipfile_demo.py", line 12, in _tmp_path
yield pathlib.Path(tmp_dir)
^^^
  File "/Users/ak/temp2/zipfile_demo.py", line 24, in main
import module
^
  File "", line 1178, in _find_and_load
  File "", line 1140, in _find_and_load_unlocked
  File "", line 1080, in _find_spec
  File "", line 1493, in find_spec
  File "", line 1462, in _get_spec
  File "", line 1418, in 
_path_importer_cache
BytesWarning: Comparison between bytes and string

--
nosy: +andrei.avk, brett.cannon

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



[issue46975] clang: error: linker command failed with exit code 1 (use -v to see invocation) on m1 mac

2022-03-14 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

I've had the same issue and fixed it with:

  brew remove --ignore-dependencies gettext

@Ned thanks for help!

--
nosy: +andrei.avk

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



[issue45993] Main branch of CPython does not build anymore on macOS

2022-03-11 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

I'm getting the same exact error but on `arm64`, and clearing the cache does 
not help.

clang=13.0.0
MacOS=11.5.2

Should I open a new issue for this?


257 warnings generated.
257 warnings generated.
Undefined symbols for architecture arm64:
  "_libintl_bindtextdomain", referenced from:
  __locale_bindtextdomain_impl in _localemodule.o
  "_libintl_dcgettext", referenced from:
  __locale_dcgettext_impl in _localemodule.o
  "_libintl_dgettext", referenced from:
  __locale_dgettext_impl in _localemodule.o
  "_libintl_gettext", referenced from:
  __locale_gettext_impl in _localemodule.o
  "_libintl_setlocale", referenced from:
  __locale_setlocale_impl in _localemodule.o
  _locale_decode_monetary in _localemodule.o
  "_libintl_textdomain", referenced from:
  __locale_textdomain_impl in _localemodule.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Programs/_freeze_module] Error 1

--
nosy: +andrei.avk

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



[issue46823] Add LOAD_FAST__LOAD_ATTR_INSTANCE_VALUE combined opcode

2022-03-02 Thread Andrei Kulakov


Change by Andrei Kulakov :


--
title: Add LOAD_FAST__LOAD_ATTR_INSTACE_VALUE combined opcode -> Add 
LOAD_FAST__LOAD_ATTR_INSTANCE_VALUE combined opcode

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



[issue45326] Unexpected TypeError with type alias+issubclass+ABC

2022-02-27 Thread Andrei Kulakov


Change by Andrei Kulakov :


--
nosy: +kj
type:  -> behavior

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



[issue45326] Unexpected TypeError with type alias+issubclass+ABC

2022-02-27 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

This error was added in https://bugs.python.org/issue33018 . See some 
discussion on that issue.

Note that first arg needs to be a type (i.e. instance of `type`) to avoid this 
error:

[ins] In [41]: class C(ABC):0

[ins] In [42]: issubclass(dict, C)
Out[42]: False

[ins] In [43]: issubclass('', C)  # TypeError: issubclass() arg 1 must be a 
class

[ins] In [44]: issubclass(typing.Dict, C)   # same error as above

--
nosy: +andrei.avk

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



[issue39100] email.policy.SMTP throws AttributeError on invalid header

2022-01-30 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

I confirmed I get the same error as Anton on 3.9 and 3.11 .

--

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



[issue45606] pathlib.Path.glob() does not list dangling symlink when pattern is the exact filename

2022-01-22 Thread Andrei Kulakov


Change by Andrei Kulakov :


--
title: pathlib.Path.glob() does not list dangling symlink when pattern is the 
exact filenane -> pathlib.Path.glob() does not list dangling symlink when 
pattern is the exact filename
versions: +Python 3.11 -Python 3.8

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



[issue45572] urllib.request:AttributeError: 'dict' object has no attribute 'get_all' in http_error_auth_reqed function

2022-01-22 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

I was wrong that the method is undocumented, it is documented but it doesn't 
explain the type of *headers* param.

The headers can also be more easily created using `email.message.Message()`.

I've added the PR documenting this param.

--

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



[issue45572] urllib.request:AttributeError: 'dict' object has no attribute 'get_all' in http_error_auth_reqed function

2022-01-22 Thread Andrei Kulakov


Change by Andrei Kulakov :


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

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



[issue46300] zlib.compress level and wbits args are shown as keyword-only in the documentation

2022-01-07 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

I forgot that '/' marks end of positional-only args, not keyword-only.

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

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



[issue46300] zlib.compress level and wbits args are shown as keyword-only in the documentation

2022-01-07 Thread Andrei Kulakov


Change by Andrei Kulakov :


--
components: +Library (Lib)

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



[issue46300] zlib.compress level and wbits args are shown as keyword-only in the documentation

2022-01-07 Thread Andrei Kulakov


New submission from Andrei Kulakov :

zlib.compress level and wbits args are shown as keyword-only in the 
documentation, however they are accepted as positional without error.

Should the docs or the code be fixed?

--
messages: 410051
nosy: andrei.avk
priority: low
severity: normal
status: open
title: zlib.compress level and wbits args are shown as keyword-only in the 
documentation
type: behavior
versions: Python 3.11

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



[issue41011] [venv] record which executable and command were used to create a virtual environment

2022-01-03 Thread Andrei Kulakov


Change by Andrei Kulakov :


--
keywords: +patch
nosy: +andrei.avk
nosy_count: 2.0 -> 3.0
pull_requests: +28592
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/30382

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



[issue41403] Uncaught AttributeError in unittest.mock._get_target

2022-01-01 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

More generally, split()/rsplit() are probably the most common operations done 
on expected string at the start of a function, i.e. most likely to be triggered 
on the wrong type passed in. At the same time to many new users 
split()/rsplit() does not imply anything related to strings, and 'split' sounds 
too generic to expect explanatory results from google search. (although the 
first few results do point to the right explanation, and rsplit does seem like 
something that would return helpful search results).

I wonder if it would be helpful, especially for .split() (and rsplit for 
consistency), to add to the error msg: "... it's likely that a string object 
was expected instead of  object".

--
nosy: +andrei.avk

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



[issue40236] datetime.datetime.strptime get day error

2022-01-01 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

I didn't realize that time.strptime is just using python module _strptime.

--

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



[issue40236] datetime.datetime.strptime get day error

2021-12-31 Thread Andrei Kulakov


Change by Andrei Kulakov :


--
keywords: +patch
pull_requests: +28534
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/30318

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



[issue40236] datetime.datetime.strptime get day error

2021-12-31 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

> I am open to discussion about trying to rationalize this behavior - it would 
> be a bit tricky but if we moved to our own implementation of the algorithm to 
> calculate %W we could detect this situation and throw an exception.

Paul: 

I'm guessing here but I think the design makes sense from a certain angle: 
consider that 0-th week is the first partial week of the year. For some date 
calculations you might want to go forward, and for others you may go back. If 
you're going back, it's easier to keep the year and the week the same and 
reference other days within that week, rather than decrementing the year and 
changing to 12th month.

This leaves the odd case of there being no partial week. Logically 0th week 
could refer to the last week of previous year, but that feels wrong because 
you're referring to it as a week of e.g. 2024 when all of its days are in 2023, 
so it's entirely a 2023 week.

So a precise definition would be to say that 0-th week is always the first week 
of the year, whether partial or full; while 1-th week is always the first full 
week. It follows from this definition that sometimes 0-th and 1-th are the same 
week.

I'll make a test PR to check if that's how time.strptime behaves on all 
platforms.

--
nosy: +andrei.avk

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



[issue41569] json.JSONEncoder.default should be called for dict keys as well

2021-12-29 Thread Andrei Kulakov


Change by Andrei Kulakov :


--
nosy: +kj
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> json.dump() ignores its 'default' option when serializing 
dictionary keys

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



[issue45853] Misspelled _IGNORED_ERROS in Lib/pathlib.py

2021-12-29 Thread Andrei Kulakov


Change by Andrei Kulakov :


--
pull_requests: +28506
pull_request: https://github.com/python/cpython/pull/30292

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



[issue41593] pathlib PermissionError problem

2021-12-29 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

Cannot reproduce on 3.9 and 3.11; the quoted fragment of code is no longer in 
pathlib.

Closing as fixed as it seems that it was fixed in 3.9 or earlier.

Please comment if you think it should be reopened.

--
nosy: +andrei.avk, kj
resolution:  -> fixed
stage:  -> resolved
status: open -> closed

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



[issue41585] policy.max_line_length is incorrectly assumed to never be None

2021-12-28 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

Seems to be a duplicate of #34800

--
nosy: +andrei.avk

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



[issue21987] TarFile.getmember on directory requires trailing slash iff over 100 chars

2021-12-28 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

The original issue was twofold:
1. below 100 char not working with trailing slash
2. over 100 char not working WITHOUT trailing slash

The second part is no longer an issue -- tested in 3.9 and 3.11 on MacOS.

Currently the issue is that a trailing slash now doesn't work for lookup of 
dirs, no matter the size of name.

This is inconsistent with the way shell commands work as well as various Python 
path related modules that tolerate trailing slash for dirs.

This can cause users to wrongly assume a dir is absent in a tarfile, so I think 
it's worth fixing and I've added a PR with a test for both old and new issue.

--

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



[issue21987] TarFile.getmember on directory requires trailing slash iff over 100 chars

2021-12-28 Thread Andrei Kulakov


Change by Andrei Kulakov :


--
nosy: +andrei.avk
nosy_count: 8.0 -> 9.0
pull_requests: +28497
pull_request: https://github.com/python/cpython/pull/30283

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



[issue31369] re.RegexFlag is not included in __all__, makes type inference less useful

2021-12-27 Thread Andrei Kulakov


Change by Andrei Kulakov :


--
keywords: +patch
nosy: +andrei.avk
nosy_count: 10.0 -> 11.0
pull_requests: +28495
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/30279

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



[issue26214] textwrap should minimize number of breaks in extra long words

2021-12-27 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

It may be worth fixing wrap() to do the nicer style of wrapping for long words. 
If we decide to do that, it should be done via a new parameter because the same 
logic (TextWrapper class) is used for `shorten` and in that case it may be 
preferable to have the chunk of longer word rather than cutting it out entirely.

--
nosy: +andrei.avk
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 3.6

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



[issue42079] Why does tarfile.next swallow InvalidHeaderError

2021-12-26 Thread Andrei Kulakov


Change by Andrei Kulakov :


--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> tarfile module next() method hides exceptions

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



[issue42259] pprint: infinite recursion for saferepr() when using nested objects, but str() works

2021-12-25 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

The recursion protection in `saferepr` applies when two conditions are met: 

- the structure is subclassed from list, tuple or dict
- __repr__ is not overriden

In this case neither condition is met.

However, the recursion is caused by the `__repr__` so when it's removed, 
recursion doesn't happen (but not due to recursion protection).

Btw also note that recursive path must be continuous for recursion detection to 
apply, e.g. if it's list[cust_obj[list[cust_obj...]]], detection also won't 
work.

I don't think we can fix this in code in a straightforward way, because  we 
want to avoid recursively calling saferepr in case __repr__ does not recurse.

In other words, if we knew __repr__ DOES recurse, we could call saferepr 
recursively and apply recursion detection without any problems, but __repr__ 
might intentionally say something like "", and then 
recursively calling saferepr would be undesirable.

So unfortunately we lose the recursion detection because of that.

One possible option would be to add an optional param like *force_recursion*, 
to recurse with detection even on overridden *__repr__*. I'm not sure it's 
worth it. But that's something users can consider: subclass PrettyPrinter and 
override saferepr() and either remove the checks for __repr__ override or add a 
param to do just that.

Current docs really make it sound like any recursion that shows up in repr() 
will be protected; it's really much more limited than that. Adding PR to 
clarify the limitations.

--
versions: +Python 3.11 -Python 3.8

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



[issue42259] pprint: infinite recursion for saferepr() when using nested objects, but str() works

2021-12-25 Thread Andrei Kulakov


Change by Andrei Kulakov :


--
keywords: +patch
nosy: +andrei.avk
nosy_count: 2.0 -> 3.0
pull_requests: +28477
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/30256

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



[issue42673] Optimize round_size for rehashing

2021-12-23 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

Closing as it sounds like OP agreed to it in the last msg; and no benchmarking 
was provided.

--
nosy: +andrei.avk
resolution:  -> rejected
stage: patch review -> resolved
status: open -> closed

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



[issue46068] Change use of warnings.warn to logging.warning in a few places

2021-12-18 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

https://discuss.python.org/t/logging-warning-vs-warnings-warn/12625/2

--

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



[issue37578] Change Glob: Allow Recursion for Hidden Files

2021-12-16 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

I want to clarify my first comment: my PR is similar to Zsh behaviour as 
described above; as I'm not 100% sure how bash behaves with `**` with globstar 
option, I can say that bash is the same as Zsh with ? and * magic characters 
(with dotglob option), and likely the same for `**` as well, but I can't test 
it (if someone can test it, please comment).

--

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



[issue37578] Change Glob: Allow Recursion for Hidden Files

2021-12-16 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

Isaac: my PR does allow [.] to match. But I probably need to update the docs to 
note that.

--

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



[issue37578] Change Glob: Allow Recursion for Hidden Files

2021-12-16 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

Zsh allows use of *, ? and ** to match hidden files and directories.

Bash allows the same for * and ? with `dotglob` option. There is also a 
`globstar` but my version of bash (on macos) is too old to have it.

By the way setting options in bash is done with `shopt -s `.

I've put up a PR that enables behavior similar to Zsh and Bash (at least for ? 
and * chars).

--

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



[issue37578] Change Glob: Allow Recursion for Hidden Files

2021-12-16 Thread Andrei Kulakov


Change by Andrei Kulakov :


--
keywords: +patch
nosy: +andrei.avk
nosy_count: 5.0 -> 6.0
pull_requests: +28372
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/30153

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



[issue46068] Change use of warnings.warn to logging.warning in a few places

2021-12-15 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

Raymond: Makes sense; I didn't know there was disagreement about this. I will 
keep this issue open for a week and then close.

--

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



[issue44413] OverflowError: mktime argument out of range after 2019

2021-12-15 Thread Andrei Kulakov


Change by Andrei Kulakov :


--
resolution: works for me -> 
stage: resolved -> needs patch
status: closed -> open
versions: +Python 3.10, Python 3.11 -Python 3.7, Python 3.8

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



[issue44413] OverflowError: mktime argument out of range after 2019

2021-12-15 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

Confirmed on Ubuntu buildbot:

https://github.com/python/cpython/runs/4537544103?check_suite_focus=true

--

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



[issue44413] OverflowError: mktime argument out of range after 2019

2021-12-15 Thread Andrei Kulakov


Change by Andrei Kulakov :


--
pull_requests: +28343
pull_request: https://github.com/python/cpython/pull/30124

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



[issue46068] Change use of warnings.warn to logging.warning in a few places

2021-12-13 Thread Andrei Kulakov


New submission from Andrei Kulakov :

In discussion on https://github.com/python/cpython/pull/29910 related to 
whether to use warnings.warn or logging.warning, I found two places in the 
library where it might make sense to change to logging.warning. There's 
probably other instances where the same change can be made but it's not easy to 
tell just by going through the list because the difference of when use one or 
the other is not always clearcut. If more instances are found, they can be 
added to this issue.

https://docs.python.org/3/howto/logging.html#when-to-use-logging

https://github.com/python/cpython/blob/eb483c46d62707bdf705491f76cf1fa9642fb47e/Lib/zoneinfo/_tzpath.py#L44

https://github.com/python/cpython/blob/f42a06ba279c916fb67289e47f9bc60dc5dee4ee/Lib/zipfile.py#L1480

The downside of making this change is that it may break 3rd party unit tests.

--
components: Library (Lib)
messages: 408488
nosy: andrei.avk
priority: low
severity: normal
status: open
title: Change use of warnings.warn to logging.warning in a few places
type: behavior
versions: Python 3.11

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



[issue45977] Unexpected effect of sys.pycache_prefix = ""

2021-12-11 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

Thanks, I've misunderstood how it works. It makes sense now. Closing as not a 
bug.

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

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



[issue44289] tarfile.is_tarfile() and tarfile.open() when used with file object may cause tarfile operations to fail

2021-12-10 Thread Andrei Kulakov


Change by Andrei Kulakov :


--
nosy: +lars.gustaebel

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



[issue44170] ShareableList cannot safely handle multibyte utf-8 characters

2021-12-08 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

I've confirmed this issue is still present in 3.11.

--

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



[issue44170] ShareableList cannot safely handle multibyte utf-8 characters

2021-12-08 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

We classify 'crash' type as seg faults etc, so changing this to 'behavior' type.

--
nosy: +andrei.avk
type: crash -> behavior

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



[issue44289] tarfile.is_tarfile() and tarfile.open() when used with file object may cause tarfile operations to fail

2021-12-08 Thread Andrei Kulakov


Change by Andrei Kulakov :


--
nosy: +kj

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



[issue44289] tarfile.is_tarfile() and tarfile.open() when used with file object may cause tarfile operations to fail

2021-12-08 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

This affects more use cases than just is_tarfile() and getmembers() results.

is_tarfile() calls open() which is the root cause of the issue. Calling open() 
2+ times will also cause the same issue.

In addition to getmembers(), extracting the tar will also silently fail. (and 
possibly other operations).

I've suggested a different fix in the comment on the PR:
https://github.com/python/cpython/pull/26488#issuecomment-989367707

--
nosy: +andrei.avk
title: tarfile.is_tarfile() modifies file object's current position -> 
tarfile.is_tarfile() and tarfile.open() when used with file object may cause 
tarfile operations to fail

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



[issue44377] Truncated error message of original function while multiprocessing or multithreading

2021-12-08 Thread Andrei Kulakov


Change by Andrei Kulakov :


--
type:  -> behavior
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 3.7

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



[issue44377] Truncated error message of original function while multiprocessing or multithreading

2021-12-08 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

Prasanth: can you provide a bit more details, are you saying that this line:
https://github.com/python/cpython/blob/2109f7880b65755329a877da3a7f8a362de07350/Lib/multiprocessing/pool.py#L86

.. truncates the exception msg? What is the exact exception type that got 
truncated?

Can you post the exact error output you got here?

--
assignee:  -> andrei.avk
nosy: +andrei.avk

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



[issue28516] contextlib.ExitStack.__enter__ has trivial but undocumented behavior

2021-12-06 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

It's a bit more readable to start by stating what a function does rather than 
what it doesn't do. I also wouldn't worry about possible future minor 
optimizations that might be added, because if that happens, a simple ".. aside 
from internal optimizations, ... " would suffice.

Something like this should work:

The __enter__ method returns the ExitStack instance, and performs no additional 
operations.

 OR

 ... and does not perform any additional operations.

--
nosy: +andrei.avk

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



[issue44077] IP_RECVTOS option is missing from socket module

2021-12-06 Thread Andrei Kulakov


Change by Andrei Kulakov :


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

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



[issue45977] Unexpected effect of sys.pycache_prefix = ""

2021-12-05 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

Can this also create the risk of 'path too long' issues?

--

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



[issue45977] Unexpected effect of sys.pycache_prefix = ""

2021-12-05 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

If CWD=/a/b and pycache_prefix=c, the resulting dir is /a/b/c as I would expect.

If CWD=/a/b and pycache_prefix='', I would expect resulting dir to be /a/b 
 instead of /a/b/a/b .

For example as the shell `cd` command accepts relative path as arg, I would 
expect that `cd c` changes to /a/b/c ; but it would be very strange to expect 
`cd ` with empty arg to change to /a/b/a/b .

--

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



[issue36392] IPv4Interface Object has no attributte prefixlen

2021-12-04 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

The docs for current bugfix releases (3.9+) have clear links from the Interface 
class attribute `network` to the Network class which lists the `prefixlen` 
attribute. I don't think it can be made clearer - there's two ways to find it - 
either searching for `prefixlen` and working backwards from network to 
interface, or following the link from Interface.network.

--
nosy: +andrei.avk, kj
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

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



[issue44735] Failed venv Activation With "&" In Folder Name

2021-12-04 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

Duplicate of https://bugs.python.org/issue44540

--
nosy: +andrei.avk
superseder:  -> venv: activate.bat fails for venv with special characters in 
PATH

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



[issue43418] FTPLib error when server returns byte message instead of string

2021-12-04 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

Closing as third party. Cowrie overrides ftplib.FTP class and implements 
__init__ in a way that doesn't work properly with some other methods of `FTP` 
class.

--
resolution:  -> third party
stage:  -> resolved
status: open -> closed

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



[issue43474] http.server.BaseHTTPRequestHandler end_header() fails

2021-12-04 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

It seems like sending zero headers is not supported, because:

- if using http/1.0
https://www.rfc-editor.org/rfc/rfc7230#section-6.1  -- Connection: close must 
be sent

- if using http/1.1 -- 
https://docs.python.org/3.11/library/http.server.html#http.server.BaseHTTPRequestHandler.protocol_version

Content-Length must be included.

Therefore closing as not a bug.

--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed
type:  -> behavior
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 3.8

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



[issue44534] unittest.mock.Mock.unsafe doc is garbled

2021-12-04 Thread Andrei Kulakov


Change by Andrei Kulakov :


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

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



[issue43098] tarfile list() method does not show file type

2021-12-03 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

Val: contributions are only now accepted in form of github PRs, not patches.

--

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



[issue37198] _parse_localename fail to parse 'en_IL'

2021-12-03 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

I confirmed that it works on 3.9 so I think this can be closed as not a bug:

[ins] In [4]: _parse_localename('en_IL')
Out[4]: ('en_IL', 'UTF-8')

--

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



[issue45977] Unexpected effect of sys.pycache_prefix = ""

2021-12-03 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

(I forgot to mention this happens on MacOS).

--

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



[issue45977] Unexpected effect of sys.pycache_prefix = ""

2021-12-03 Thread Andrei Kulakov


New submission from Andrei Kulakov :

Setting sys.pycache_prefix = "", re-creates CWD structure under current 
directory, e.g. if run from /Users/foo/test, will create 
/Users/foo/test/Users/foo/test/myfile.pyc . Is that intentional? It seems a 
little weird. At least it might be good to document it.

--
components: Interpreter Core
messages: 407632
nosy: andrei.avk
priority: low
severity: normal
status: open
title: Unexpected effect of sys.pycache_prefix = ""
type: behavior
versions: Python 3.11

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



[issue20907] behavioral differences between shutil.unpack_archive and ZipFile.extractall

2021-12-03 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

I forgot to add this:

 - we may not want to follow the behavior of command line unzip - it's 
interactive so considerations are somewhat different. For example, it will warn 
if file is being overwritten and show a prompt on whether to skip, overwrite, 
abort, etc.

--

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



[issue20907] behavioral differences between shutil.unpack_archive and ZipFile.extractall

2021-12-03 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

I think it may be good enough to add a warning on skipped files in 
_unpack_zipfile().

 - this way we keep backwards compatibility (especially since behavior in both 
modules differed for such a long time.)

 - it's not clear that ZipFile behavior is superior -- for example, what if a 
file with stripped path components overwrites existing files?

 - if requested in the future, a parameter can be added to enable ZipFile-like 
behavior

 - it can be very confusing if files are silently skipped, especially if an 
archive has thousands of files. 

I've added a PR, note that the test in PR also tests that files with '..' are 
indeed skipped, we don't have a test for that now, so that's an added benefit.

--

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



[issue20907] behavioral differences between shutil.unpack_archive and ZipFile.extractall

2021-12-03 Thread Andrei Kulakov


Change by Andrei Kulakov :


--
nosy: +andrei.avk
nosy_count: 6.0 -> 7.0
pull_requests: +28135
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/29910

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



[issue43153] tempfile seems to treat a file as a directory when processing an exception in the onerror()

2021-11-30 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

My last comment was wrong, the issue I linked is unrelated.

I think the actual issue here is the code here:
https://github.com/python/cpython/blob/4b97d974ecca9cce532be55410fe851eb9fdcf21/Lib/tempfile.py#L826

If `path` is a file that causes a permission error, `rmtree` is called and 
causes a NotADirectory error.

This can be confusing when debugging and can lead to a bug if user's code tries 
to catch a PermissionError it expects but instead gets NotADirectory error.

A solution is probably to check if path is a file and error is PermissionError 
and if ignore_errors=False, re-raise it instead of calling rmtree(). If 
ignore_errors=True, return instead of calling rmtree().

I don't have windows so can't test the OP code with this approach.

Serhiy: adding you since you wrote `def onerror()` in tempfile module, do you 
think that is the cause of the issue and the right solution for it?

--
nosy: +kj, serhiy.storchaka

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



[issue44413] OverflowError: mktime argument out of range after 2019

2021-11-29 Thread Andrei Kulakov


Change by Andrei Kulakov :


--
nosy: +kj

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



[issue44413] OverflowError: mktime argument out of range after 2019

2021-11-29 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

Cannot reproduce with 3.8.6 on MacOS. The code runs without any errors. As OP 
hasn't responded in 4 months I think we should close as "works for me".

--
nosy: +andrei.avk

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



[issue41102] ZipFile.namelist() does not match the actual files in .zip file

2021-11-29 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

Closing by request of OP.

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

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



[issue43905] dataclasses.astuple (and .asdict) do deepcopy on all fields

2021-11-29 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

Thank  you for reviewing Eric!

--

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



[issue44675] Cross-platform issues with private methods and multiprocessing

2021-11-29 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

If we are not going to fix this issue in pickling at this time, I think it 
makes sense to raise an error with a good, clear explanation in 
multiprocessing.Process(target=self.__method), which is affected by this and 
caused some confusion in this issue: #44675 .

Josh: adding you since you reported this issue in another ticket, hope that's 
okay.

--
nosy: +josh.r

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



[issue44675] Cross-platform issues with private methods and multiprocessing

2021-11-28 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

More details and a suggested fix here: #37852 .

--

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



[issue44675] Cross-platform issues with private methods and multiprocessing

2021-11-28 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

The issue seems to be that there was a change between 3.7.7 and 3.8.6, - 
multiprocessing started using pickle dump / load which cannot handle double 
underscore methods.

See #33007 for a reproducer with pickle.

I'm using MacOS and this multiprocessing example in OP works fine in 3.7.7 and 
raises the same error as OP in 3.8.6. So from my side at least it doesn't 
appear to be a cross-platform issue (but I'm not sure why it worked on Linux on 
3.8.10 for OP).

I've also reproduced it on the latest 3.11.

So this appears to be a regression and if there's an easy fix, it's probably 
worth fixing.

--
nosy: +andrei.avk

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



[issue43905] dataclasses.astuple (and .asdict) do deepcopy on all fields

2021-11-28 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

Eric: I've closed a similar issue about asdict() and now updating the title to 
keep track of both in this issue. Let me know if you want to keep them separate 
instead.

--
title: dataclasses.astuple does deepcopy on all fields -> dataclasses.astuple 
(and .asdict) do deepcopy on all fields

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



[issue44678] Seperate error message for discontinuous padding in binascii.a2b_base64 strict mode

2021-11-28 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

Looks like it's fixed so closing it..

--
nosy: +andrei.avk, kj
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

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



[issue44695] asdict use deep copy to dataclass instances

2021-11-28 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

Duplicate of https://bugs.python.org/issue43905

--
nosy: +andrei.avk
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> dataclasses.astuple does deepcopy on all fields

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



[issue45299] SMTP.send_message() does from mangling when it should not

2021-11-25 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

Grant: sounds good! I can do the initial PR review. Note that the PR will need 
a test and a news entry. See the link below on authoring PRs:

https://devguide.python.org/pullrequest/

--

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



[issue45299] SMTP.send_message() does from mangling when it should not

2021-11-25 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

R. David: `mangle_from_` is the only exception; I agree it seems likely it was 
done this way for backwards compatibility.

Grant: do you agree with the fix to logic? Also do you agree that mangle_from_ 
is the only setting that's not being applied to msg generation from message 
policy? Would you like to work on the PR? If not, I can create the PR.

--

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



[issue45299] SMTP.send_message() does from mangling when it should not

2021-11-23 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

There are 3 policy settings that are also being passed as parameters to 
Generator/BytesGenerator:

- mangle_from_
- linesep
- maxheaderlen

Both linesep and maxheaderlen are being inserted into policy after self.policy 
(if there is one) overrides message policy.

The docs for both linesep and maxheaderlen match the code.

So this only leaves us the buggy `mangle_from_`.

I think it makes sense to fix it in `send_message()` rather than in 
BytesGenerator because:

- less backwards compatibility breakage
- there's already a workaround for BytesGenerator (provide the parameter)
- there were no reports from users of BytesGenerator

We have two ways to fix it in send_message() --
- provide policy as an arg
- provide mangle_from_ as an arg

I think the 2nd choice is better because it's more direct and easier to 
understand. If we use msg.policy as an arg, it looks like we're using 
msg.policy to override msg.policy, which wouldn't make any sense except that 
mangle_from_ is being set from policy arg rather than msg.policy.

If there's code out there that relies on this bug in send_message(), I would 
guess it's more likely to be test suites that compare output to version where 
*from* is mangled.

Docs for BytesGenerator should be fixed to warn about this issue.

--

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



[issue45299] SMTP.send_message() does from mangling when it should not

2021-11-23 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

Seems like a reasonable request to me.

I can make the PR+test.

To minimize backwards-incompatible change, we can pass 
`_mangle_from=policy._mangle_from` argument instead of passing the entire 
policy. Is that a good idea or passing the policy argument should be fine too?

--
nosy: +andrei.avk, r.david.murray
stage:  -> needs patch
type:  -> behavior
versions: +Python 3.10, Python 3.11

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



[issue45572] urllib.request:AttributeError: 'dict' object has no attribute 'get_all' in http_error_auth_reqed function

2021-11-22 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

I'm not sure about the hang in 3.7 and CVE, but as far as `get_all()` error is 
concerned, it's due to passing the wrong kind of argument as `headers`.

For this (undocumented) method, `headers` should be a Message object created in 
this way, e.g.:

headers = email.message_from_string(
'Content-type: %s\nContent-length: %d\nLast-modified: %s\n' %
(mtype or 'text/plain', size, modified))


(see 
https://github.com/python/cpython/blob/024209401ebc8a011f242af00efdd8ecece6953d/Lib/urllib/request.py#L1509)

Header obj created in this way does have the `get_all()` method, and I tested 
that the method runs without further errors.

--
nosy: +andrei.avk, kj

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



[issue45555] Object stays alive for weak reference if an exception happens in constructor

2021-11-22 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

Note also that in addition to not being related to weakref as Pablo said, it's 
also not related to the __init__() -- the exception can be moved to any method 
of the object with the same result.

It may be good to update the title so that it's not misleading?

--
nosy: +andrei.avk

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



[issue45853] Misspelled _IGNORED_ERROS in Lib/pathlib.py

2021-11-21 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

Serhiy: I think you're right, it was likely meant to be _IGNORED_ERRNOS; for 
inlining it, it looks like it wasn't inlined to be more readable, but if we 
inline it, we should also inline _IGNORED_WINERRORS. I don't mind inlining both.

--

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



[issue22276] pathlib glob ignores trailing slash in pattern

2021-11-20 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

Generally if Path is created with a trailing separator, I think it should error 
out for all methods that apply to files, for example `.touch()`, `read*()`, 
`write*()`, others.

This is consistent with shell commands:

touch xyz/  
 touch: xyz/: Not a directory 

echo 'blah' > xyz/  
 
zsh: not a directory: xyz/

--

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



[issue22276] pathlib glob ignores trailing slash in pattern

2021-11-20 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

I meant to say:

path.glob('myfile/') => [PosixPath('myfile')]

--

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



[issue22276] pathlib glob ignores trailing slash in pattern

2021-11-20 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

I have also run into this when looking into path.glob('dangling_symlink') issue.

I can add a few things (in the examples, *myfile* is a file, not a directory):

This is probably more common / less obscure than '*/':

path.glob('myfile/') => True

This is inconsistent with how shell `ls` command works and with glob.glob() and 
looks wrong.

Path('myfile/').exists() => True

Path('myfile/') == Path('myfile') => True

str(Path('myfile/')) => 'myfile'

You can compare this to behavior of `ls` (tested on MacOS):

ls myfile
myfile

ls myfile/
ls: myfile/: Not a directory

I think many users will expect behavior consistent with `ls` and `glob.glob`. 
I've used `ls` in this manner before.

--
nosy: +andrei.avk

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



[issue45853] Misspelled _IGNORED_ERROS in Lib/pathlib.py

2021-11-20 Thread Andrei Kulakov


Change by Andrei Kulakov :


--
components: +Library (Lib)
priority: normal -> low
stage:  -> needs patch
type:  -> enhancement
versions: +Python 3.11

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



[issue45853] Misspelled _IGNORED_ERROS in Lib/pathlib.py

2021-11-20 Thread Andrei Kulakov


New submission from Andrei Kulakov :

Should be _IGNORED_ERRORS

This name was added 3 years ago: 
https://github.com/python/cpython/commit/216b745eafa7cd4a683a8405dcfbd7f5567f504c

It's only used in a single place in the module. But I'm not sure if it's worth 
fixing. It is an internal, undocumented name, and not very likely to be used in 
user code but it's possible.

--
messages: 406660
nosy: andrei.avk
priority: normal
severity: normal
status: open
title: Misspelled _IGNORED_ERROS in Lib/pathlib.py

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



[issue45606] pathlib.Path.glob() does not list dangling symlink when pattern is the exact filenane

2021-11-19 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

By the way note that path.glob('**/my_symlink') also does return the dangling 
symlink match. And glob.glob('my_symlink') also returns a dangling symlink.

--

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



[issue45606] pathlib.Path.glob() does not list dangling symlink when pattern is the exact filenane

2021-11-19 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

Rasmus: thanks for the report, it does seem like a bug to me.

--

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



[issue45606] pathlib.Path.glob() does not list dangling symlink when pattern is the exact filenane

2021-11-19 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

The issue is that _PreciseSelector follows the symlink when it checks if a path 
exists before yielding it as a result.

I've put up a PR with a fix; I've also added a *follow_symlinks* arg to 
`exists()` method because it seems more logical to be able to test if a path 
exists via the same method rather than having to also remember and to check for 
it being a symlink.

I will add docs and news a bit later today or tomorrow.

--
assignee:  -> andrei.avk
nosy: +kj

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



[issue45606] pathlib.Path.glob() does not list dangling symlink when pattern is the exact filenane

2021-11-19 Thread Andrei Kulakov


Change by Andrei Kulakov :


--
keywords: +patch
nosy: +andrei.avk
nosy_count: 1.0 -> 2.0
pull_requests: +27897
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/29655

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



[issue44995] "Hide the prompts and output" works abnormal

2021-11-12 Thread Andrei Kulakov


Change by Andrei Kulakov :


--
keywords: +newcomer friendly

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



[issue44887] test_input_tty hangs when run multiple times in the same process on macOS 10.15

2021-11-12 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

I've looked into this and the hang happens on this line:

https://github.com/python/cpython/blob/de3db1448b1b983eeb9f4498d07e3d2f1fb6d29d/Lib/test/test_builtin.py#L2030

So the issue is that on the second run, there's nothing to read on that fd. 
I've tried using os.stat to check if there's data on the fd, but it returned 0 
data in both 1st and 2nd runs.

However, if a small sleep is added before running os.stat, it does return size 
of data on 1st run and returns 0 on 2nd run, meaning it's possible to avoid the 
hang and error out instead (is that an improvement?)

This is on MacOS 11.4 Big Sur by the way.

This is my test debug branch:

https://github.com/python/cpython/compare/main...akulakov:Test-check_input_tty-FIX?expand=1

--
nosy: +andrei.avk, kj

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



[issue45054] json module should issue warning about duplicate keys

2021-11-11 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

Another good option would be to use typed dict like `mydict : dict[int,str] = 
{}`; and use typed values when populating the dict; this way a type checker 
will warn you of inconsistent key types.

--

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



[issue45054] json module should issue warning about duplicate keys

2021-11-11 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

In general this sounds reasonable; - but a couple of thoughts / comments:

- If you have a dict with mixed numbers in str format and in number format 
(i.e. ints as numbers and ints as strings in your case), you are creating 
problems in many potential places. The core of the problem is logically 
inconsistent keys rather than the step of conversion to JSON. So the most 
useful place for warning would be when adding a new key, but that wouldn't be 
practical.

- Even if something is to be done at conversion to JSON, it's not clear if it 
should be a warning (would that be enough when the conversion is a logical 
bug?), or it should be some kind of strict=True mode that raises a ValueError?

--
nosy: +andrei.avk

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



[issue45091] inspect.Parameter.__str__ does not include subscripted types in annotations

2021-11-10 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

I have confirmed and tested -- this was fixed in 
https://github.com/python/cpython/pull/29212 and so I'm closing it as fixed.

--
nosy: +andrei.avk, kj
resolution:  -> fixed
stage:  -> resolved
status: open -> closed

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



[issue45053] MD5SumTests.test_checksum_fodder fails on Windows

2021-11-10 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

This was fixed in https://github.com/python/cpython/commit/dd7b816ac87, perhaps 
this should be closed as fixed?

It sounds like the general solution is beyond the scope of this issue and 
doesn't need to be tracked here.

--
nosy: +andrei.avk

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



[issue45171] stacklevel handling in logging module is inconsistent

2021-11-08 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

The stacklevel arg was added 3+ years ago, wouldn't fixing this break a lot of 
code in a way that's hard to detect? That is to say, logs will look just fine, 
but when you try to debug an issue, you will realise it's pointing to an 
unhelpful location?

--
nosy: +andrei.avk

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



[issue43656] TracebackException or StackSummary.extract with capture_locals=True fail to catch exceptions raised by repr() on value of frame local variable in FrameSummary.__init__.

2021-11-08 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

Martin:

I have a couple of concerns:

 - Generally (AFAIK) Python is very conservative about silencing arbitrary 
exceptions. There are a few functions with args like `ignore_errors`, but those 
are for errors in the logic of respective functions. I don't recall examples 
where any error would be silenced via an argument, but if there are such cases, 
it would be interesting to look into how the design decision was made.

In this case of course arbitrary exceptions coming any objects' __repr__ may be 
silenced.

There is a clear and very explicit way to catch exceptions via try/except and 
as a dev, I would really want to be able to look at a module, look at all 
try/except clauses and be confident that exceptions are not silenced elsewhere.

 - You are targeting this fix to production use, but realistically, if merged, 
it will be used both in testing and production. Which means, by not seeing 
these exceptions in testing, you will have a higher chance of deploying them to 
production where they can surface in other circumstances.

IOW, as a dev I might prefer to see these errors early and often, rather than 
have a mechanism that ends up silencing errors more broadly than intended.

I'm not saying this fix should be rejected, but that there's a tricky balance 
here -- and I don't feel confident enough about this solution to approve the PR 
if I reviewed it.

--

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



  1   2   3   4   5   >