[issue42015] Order of decrementing reference counts in meth_dealloc

2020-10-12 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

___
Python tracker 

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



[issue42024] Exception ignored in: .remove at 0x7f6a325f2ea0>

2020-10-12 Thread jayesh


New submission from jayesh :

Team,

I am getting python warning messages while run ansible.
Previously I was using python 3.5.3, but after read the below article, I 
upgraded it with python 3.5.4. 

ref: https://github.com/ansible/ansible/issues/21982

Still facing the same issues. Kindly find attached logs for the same and help 
us to solve this issue.

Thanks

--
files: pthon-warning-3.5.4.txt
messages: 378539
nosy: jayesh007
priority: normal
severity: normal
status: open
title: Exception ignored in: .remove at 0x7f6a325f2ea0>
type: compile error
versions: Python 3.5
Added file: https://bugs.python.org/file49513/pthon-warning-3.5.4.txt

___
Python tracker 

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



Re: Covariance matrix syntax

2020-10-12 Thread Meghna Karkera
Could you let me know what is the back end calculation of this covariance
matrix syntax np.cov

On Tue, Oct 13, 2020, 10:14 Bruno P. Kinoshita 
wrote:

> I think the np.cov is from the numpy module (imported/aliased as np?).
>
> If so, the numpy repository should have what you are looking for:
>
>
>
> https://github.com/numpy/numpy/blob/156cd054e007b05d4ac4829e10a369d19dd2b0b1/numpy/lib/function_base.py#L2276
>
>
> Hope that helps
>
> Bruno
>
> On Tuesday, 13 October 2020, 5:38:55 pm NZDT, Meghna Karkera <
> mkarker...@gmail.com> wrote:
>
>
> May I know the steps or procedure behind covariance matrix syntax,
> np.cov(covar_matrix) in python
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Covariance matrix syntax

2020-10-12 Thread Meghna Karkera
May I know the steps or procedure behind covariance matrix syntax,
np.cov(covar_matrix) in python
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue42023] Argparse: Add a "display" arg

2020-10-12 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +paul.j3, rhettinger

___
Python tracker 

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



[issue41822] Document the meaning of values for sys.float_info.rounds

2020-10-12 Thread Emmanuel Arias


Change by Emmanuel Arias :


--
nosy: +eamanu

___
Python tracker 

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



Re: What might cause my sample program to forget that already imported datetime?

2020-10-12 Thread dn via Python-list

On 13/10/2020 06:47, Steve wrote:

Thank you, those two fixes took care of the problem.



At the top of my sample program, I have:

import datetime
from datetime import *

...

These are incompatible with each other, so you're going to get issues.
I'd recommend doing just the first one, and then identifying d2 as
datetime.datetime.now() instead.



These questions befuddle the mind when first presented, yet the answer 
seems so logical once it becomes hindsight...


Evidence:-
(blank lines added for readability)

dn $ ... python3
Python 3.8.5 (default, Aug 12 2020, 00:00:00)
[GCC 10.2.1 20200723 (Red Hat 10.2.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from pprint import pprint as pp

>>> pp( locals() )
{'__annotations__': {},
 '__builtins__': ,
 '__doc__': None,
 '__loader__': ,
 '__name__': '__main__',
 '__package__': None,
 '__spec__': None,
 'pp': }

>>> import datetime
>>> pp( locals() )
{'__annotations__': {},
 '__builtins__': ,
 '__doc__': None,
 '__loader__': ,
 '__name__': '__main__',
 '__package__': None,
 '__spec__': None,
 'datetime': ,
 'pp': }

>>> from datetime import *
>>> pp( locals() )
{'MAXYEAR': ,
 'MINYEAR': 1,
 '__annotations__': {},
 '__builtins__': ,
 '__doc__': None,
 '__loader__': ,
 '__name__': '__main__',
 '__package__': None,
 '__spec__': None,
 'date': ,
 'datetime': ,
 'datetime_CAPI': 0x7fc3d1626ea0>,

 'pp': ,
 'sys': ,
 'time': ,
 'timedelta': ,
 'timezone': ,
 'tzinfo': }

Apologies for the awkward email word-wrap.
Note the (absence and then) changing entry for 'datetime'.
--
Regards =dn
--
https://mail.python.org/mailman/listinfo/python-list


[issue37461] email.parser.Parser hang

2020-10-12 Thread Emmanuel Arias


Change by Emmanuel Arias :


--
nosy: +eamanu

___
Python tracker 

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



[issue42010] Generic types accept indexing/subscripting, causing confusion

2020-10-12 Thread Ken Jin


Ken Jin  added the comment:

Partly due to Python 3.9.0's nascency, I've not been able to find online cases 
of beginners getting confused by this specific behavior.

Wow I didn't know about integer variadics, assuming they make their way into 
3.11, I can see why it'd be better to leave that in for now.

I'm going to close the PR, and if there are no more discussions in the next 30 
days, I'll close this bug report too. Thanks for clarifying.

--

___
Python tracker 

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



[issue40422] Light refactor: create a common _Py_closerange API

2020-10-12 Thread Kyle Evans


Change by Kyle Evans :


--
pull_requests: +21651
pull_request: https://github.com/python/cpython/pull/22680

___
Python tracker 

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



[issue41972] bytes.find consistently hangs in a particular scenario

2020-10-12 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

I used random_bench.py to compare PR 22679 to Master, and the results are in 
bench_results.txt. Results were varied. I suppose this depends on what cases we 
want to optimize for.

--
Added file: https://bugs.python.org/file49512/random_bench.py

___
Python tracker 

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



[issue40422] Light refactor: create a common _Py_closerange API

2020-10-12 Thread Gregory P. Smith


Gregory P. Smith  added the comment:


New changeset 64eb259cc1e42a5f74b5911a518d2c50daa8d50b by Kyle Evans in branch 
'master':
bpo-40422: Move _Py_*_SUPPRESS_IPH bits into _Py_closerange (GH-22672)
https://github.com/python/cpython/commit/64eb259cc1e42a5f74b5911a518d2c50daa8d50b


--

___
Python tracker 

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



[issue39481] Implement PEP 585 (Type Hinting Generics In Standard Collections)

2020-10-12 Thread Guido van Rossum


Guido van Rossum  added the comment:


New changeset 1c217652b690c184b43d8e2b6529a60a14e64328 by Saiyang Gou in branch 
'3.9':
[3.9] bpo-39481: Fix duplicate SimpleQueue type in test_genericalias.py 
(GH-22619) (#22624)
https://github.com/python/cpython/commit/1c217652b690c184b43d8e2b6529a60a14e64328


--

___
Python tracker 

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



[issue41972] bytes.find consistently hangs in a particular scenario

2020-10-12 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

PR 22679 is a draft that does the two-way algorithm but also adds both of the 
tricks from Fredrik's implementation: a bit-set "bloom filter" and remembering 
the skip-distance between some pair of characters.

--
Added file: https://bugs.python.org/file49511/bench_results.txt

___
Python tracker 

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



[issue41972] bytes.find consistently hangs in a particular scenario

2020-10-12 Thread Dennis Sweeney


Change by Dennis Sweeney :


--
pull_requests: +21650
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/22679

___
Python tracker 

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



[issue42010] Generic types accept indexing/subscripting, causing confusion

2020-10-12 Thread Guido van Rossum


Guido van Rossum  added the comment:

Have you observed actual users getting confused by this? (E.g. StackOverflow or 
mailing list posts.) I would assume that if you try to *do* anything with the 
resulting object it's going to cause a traceback, and from there it's pretty 
straightforward to debug the situation. (Maybe not for absolute beginners, but 
they have a lot of ways to confuse themselves. :-)

There are people working on proposals for "integer variadics" that would 
actually give meaning to things like list[10] (or at least to A[10] and A[N, M] 
where A is a tensor type) so I am reluctant to forbid this now -- we might have 
to allow it in the next release.

--

___
Python tracker 

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



[issue41756] Do not always use exceptions to return result from coroutine

2020-10-12 Thread Vladimir Matveev


Change by Vladimir Matveev :


--
pull_requests: +21649
stage: resolved -> patch review
pull_request: https://github.com/python/cpython/pull/22677

___
Python tracker 

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



[issue42013] venv on Windows with symlinks is broken if invoked with -I

2020-10-12 Thread Eryk Sun


Eryk Sun  added the comment:

> So I'm +1 on fixing this by calling realpath.

In POSIX, calculate_path() in Modules/getpath.c calls calculate_argv0_path() 
before it calls calculate_read_pyenv(), and calculate_argv0_path() in turn 
calls resolve_symlinks(>argv0_path). Thus "pyvenv.cfg" isn't found 
and isn't used to find the standard library in POSIX when a virtual environment 
uses symlinks. Later on, "pyvenv.cfg" gets read by the site module, if 
importing the latter isn't skipped via -S. The site module sets sys._home to 
the `home` value, but sys._home only appears to be used by sysconfig when 
running from the build directory.

In Windows, calculate_path() in PC/getpathp.c could get the final (real) path 
for argv0_path before calling calculate_pyvenv_file(). Then, just like in 
POSIX, the environment's "pyvenv.cfg" file won't be found and won't be used to 
find the standard library when a virtual environment uses symlinks.

--

___
Python tracker 

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



[issue42020] interpreter hangs forever on invalid input

2020-10-12 Thread STINNER Victor


STINNER Victor  added the comment:

I don't see anything wrong with Python itself and I suggest to close the issue 
as "not a bug".

--

___
Python tracker 

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



[issue28002] ast.unparse can't roundtrip some f-strings

2020-10-12 Thread Shantanu


Shantanu  added the comment:

Bumping again!

--

___
Python tracker 

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



[issue42015] Order of decrementing reference counts in meth_dealloc

2020-10-12 Thread Henry Schreiner


Henry Schreiner  added the comment:

I tested before the patch, and I got 17 segfaults running a pybind11 module 20 
times. After the patch, I ran about 50 times and had no segfaults!

--

___
Python tracker 

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



[issue42015] Order of decrementing reference counts in meth_dealloc

2020-10-12 Thread miss-islington


miss-islington  added the comment:


New changeset 8a12503b4532e33d590ecea7eb94cd0e6b0f1488 by Miss Skeleton (bot) 
in branch '3.9':
bpo-42015: Reorder dereferencing calls in meth_dealloc, to make sure m_self is 
kept alive long enough (GH-22670)
https://github.com/python/cpython/commit/8a12503b4532e33d590ecea7eb94cd0e6b0f1488


--

___
Python tracker 

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



[issue41756] Do not always use exceptions to return result from coroutine

2020-10-12 Thread Yury Selivanov


Yury Selivanov  added the comment:

> Also, in Include/abstract.h it should only be available for limited C API >= 
> 3.10:

Vladimir, could you please submit a PR?

> We now should discuss the behavior of PySend_Iter() if value is NULL. It is 
> not documented, the current behavior differs from the behavior for non-NULL 
> value, and it is used in the ceval loop.

IMO: I'd keep the behavior and just document it.

--

___
Python tracker 

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



[issue41756] Do not always use exceptions to return result from coroutine

2020-10-12 Thread Yury Selivanov


Change by Yury Selivanov :


--
status: closed -> open

___
Python tracker 

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



[issue42023] Argparse: Add a "display" arg

2020-10-12 Thread ThatXliner


New submission from ThatXliner :

In argparse, I've always wanted a way to make colored help text like those of 
poetry and pipenv. But argparse's show help isn't well documented (Therefore, I 
can't find a way to completely modify the help text), and the metavar arg isn't 
really helpful. I want to do something like this:

>>> import argparse
>>> parser = argparse.ArgumentParser()
>>> parser.add_argument("foo", help="To foo a bar", display="FOO")
>>> parser.print_help()

usage: main.py [-h] foo

positional arguments:
  FOO To foo a bar

optional arguments:
  -h, --help  show this help message and exit

>>>

That way, I can colorize the help output.

--
components: Library (Lib)
messages: 378526
nosy: ThatXliner
priority: normal
severity: normal
status: open
title: Argparse: Add a "display" arg
type: enhancement
versions: Python 3.10, Python 3.9

___
Python tracker 

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



[issue42015] Order of decrementing reference counts in meth_dealloc

2020-10-12 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 3.0 -> 4.0
pull_requests: +21648
pull_request: https://github.com/python/cpython/pull/22674

___
Python tracker 

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



[issue42015] Order of decrementing reference counts in meth_dealloc

2020-10-12 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 04b8631d84a870dda456ef86039c1baf34d08500 by Yannick Jadoul in 
branch 'master':
bpo-42015: Reorder dereferencing calls in meth_dealloc, to make sure m_self is 
kept alive long enough (GH-22670)
https://github.com/python/cpython/commit/04b8631d84a870dda456ef86039c1baf34d08500


--

___
Python tracker 

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



[issue42022] Allow ensurepip to work without bundled wheels

2020-10-12 Thread Filipe Laíns

New submission from Filipe Laíns :

Some Linux distributions, such as Debian, have guidelines against shipping 
things like prebuilt wheels.

Taking Debian as an example, they remove the pip and setuptools wheels and 
consequently break ensurepip. This also has some implications in the venv 
module.

As a way to fix this, I would like to propose for ensurepip to install .pth 
files pointing to the pip and setuptools packages in purelib/platlib.

This behavior could either be switched on by a flag in the makefile or, maybe, 
if the wheels are not found.

Do you think this would be a reasonable approach?
Currently, we cannot rely on the ensurepip to work. Some projects that really 
need it are shipping a vendored version of the module.

--
components: Library (Lib)
messages: 378524
nosy: FFY00, dstufft, ncoghlan, p-ganssle, pradyunsg
priority: normal
severity: normal
status: open
title: Allow ensurepip to work without bundled wheels
type: enhancement
versions: Python 3.10

___
Python tracker 

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



[issue42017] Add new type in typing

2020-10-12 Thread Guido van Rossum


Guido van Rossum  added the comment:

You can easily define that yourself if you need it, though honestly the utility 
seems marginal.

--
resolution:  -> rejected
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue34976] IDLE: Replace the search dialog with a search bar

2020-10-12 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Notepad++ Find by marks all matches in the current doc as 'found', with a 
distinct (darker) highlight for the 'selected' found.  Double clicking selects 
a word, as in IDLE, *and* finds all matches.  One can then either 
cut/copy/replace the selection, as in IDLE, *or* look at other matches in the 
file.

Notepad++ also offers options to (in addition) 'Find all' in current doc or all 
opened docs.  This lists the hits in a separate box, as with IDLE's Find all.  
Double clicking on a hit line goes to that line.  (Easier than RtClick/goto.)

I suspect I would find live highlighting annoying.  Why would having all 'a's 
on a page light up when I type 'a' be a plus?  But I will try your patch when 
we are ready to focus on search/replace/find.  

I have mentioned elsewhere that I might go for a minimal search box on the 
status line separate from the dialog(s).

--

___
Python tracker 

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



[issue42021] Fix possible ref. leaks in _sqlite3 module initialisation

2020-10-12 Thread Erlend Egeberg Aasland


Change by Erlend Egeberg Aasland :


--
type:  -> behavior

___
Python tracker 

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



[issue34976] IDLE: Replace the search dialog with a search bar

2020-10-12 Thread Tal Einat


Tal Einat  added the comment:

I should mention one *major* advantage of using a search/replace bar: Live 
highlighting of matches *as you type*. It really is a vastly better experience; 
if you haven't tried it yet, please do.

--

___
Python tracker 

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



[issue42021] Fix possible ref. leaks in _sqlite3 module initialisation

2020-10-12 Thread Erlend Egeberg Aasland


Change by Erlend Egeberg Aasland :


--
nosy: +berker.peksag

___
Python tracker 

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



[issue34976] IDLE: Replace the search dialog with a search bar

2020-10-12 Thread Tal Einat


Tal Einat  added the comment:

The version in the PR is modeled after similar features in IDEs, not browsers. 
I mentioned browsers since they are very commonly used, and to the best of my 
knowledge all modern browsers use search bars. Therefore, as a UI element, 
search bars are now commonplace, unsurprising, and require no training to use.

As for replace, while many IDEs use a bar, many word processors do indeed still 
use a dialog for search/replace, and I've seen text editors use a bar for 
search but a dialog for replace.

I first implemented this for my personal use, since I much prefer bars to 
dialogs. But I can see the argument that they can be harder to use for novice 
users.

If we decide not to go with this path, I'll try to extract some of the 
improvements made to the search engine, such as highlighting all matches, into 
a PR improving the existing search and replace dialogs.

--

___
Python tracker 

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



[issue42020] interpreter hangs forever on invalid input

2020-10-12 Thread Eryk Sun


Eryk Sun  added the comment:

In Windows 10 2004, CSI is currently supported by the console host 
(conhost.exe) if virtual-terminal mode is enabled. Windows Terminal Preview 
supports many more C1 control codes, as will conhost.exe in the next release of 
Windows 10. This should be 'fun' considering the C1 controls block isn't 
reserved by Windows filesystems. CMD and PowerShell depend on the C0 controls 
being reserved and depend on the C1 controls not being implemented. They don't 
implement any escaping of control characters when listing filenames in a 
directory, unlike a tradition POSIX shell. Now that the console and Windows 
Terminal implement C1 controls, maybe PowerShell can be updated to escape them 
in file listings, but I don't see what can be done for CMD, which doesn't 
support string literals with escape sequences.

--

___
Python tracker 

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



[issue42021] Fix possible ref. leaks in _sqlite3 module initialisation

2020-10-12 Thread Erlend Egeberg Aasland


Change by Erlend Egeberg Aasland :


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

___
Python tracker 

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



[issue42020] interpreter hangs forever on invalid input

2020-10-12 Thread Eryk Sun


Eryk Sun  added the comment:

The terminal you're using apparently implements C1 controls [1]. U+009B is the 
Control Sequence Introducer (CSI) for ANSI escape sequences. U+0090 starts a 
Device Control String (DCS), and it gets terminated by U+009C, a String 
Terminator (ST). For example, in GNOME Terminal in Linux:

>>> print('spam\x9b4Deggs')
eggs

>>> print('spam\x90some DCS string\x9c')
spam

---

[1] https://en.wikipedia.org/wiki/C0_and_C1_control_codes

--
nosy: +eryksun

___
Python tracker 

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



[issue41756] Do not always use exceptions to return result from coroutine

2020-10-12 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Few things I forget about. The new C API function should be exported in 
PC/python3dll.c.

Also, in Include/abstract.h it should only be available for limited C API >= 
3.10:

#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030A
...
#endif

We now should discuss the behavior of PySend_Iter() if value is NULL. It is not 
documented, the current behavior differs from the behavior for non-NULL value, 
and it is used in the ceval loop. We should document this case explicitly and 
maybe change the behavior if it would be more appropriate.

--

___
Python tracker 

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



[issue42021] Fix possible ref. leaks in _sqlite3 module initialisation

2020-10-12 Thread Erlend Egeberg Aasland


New submission from Erlend Egeberg Aasland :

Handle PyDict_SetItemString() errors in _sqlite3 init by dereferencing the item 
object and then goto error.

--
components: Library (Lib)
messages: 378516
nosy: erlendaasland
priority: normal
severity: normal
status: open
title: Fix possible ref. leaks in _sqlite3 module initialisation
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



[issue41756] Do not always use exceptions to return result from coroutine

2020-10-12 Thread Yury Selivanov


Yury Selivanov  added the comment:

With the latest PR now merged this issue can be closed. Please reopen if there 
are any other action items left.

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

___
Python tracker 

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



[issue37209] Add what's new entries for pickle enhancements

2020-10-12 Thread Antoine Pitrou


Change by Antoine Pitrou :


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

___
Python tracker 

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



[issue42020] interpreter hangs forever on invalid input

2020-10-12 Thread denis

New submission from denis :

Python 3.8.5, Python 3.7.3
When trying to print invalid unicode, interpreter goes to a completely 
unresponsive state

>>> print("\x9b")


eyboardInterrupt
>>> print("\xa5")
¥
>>> print("\x95")

>>> print("\x90")
denis@debian:~$ 

--
components: Unicode
messages: 378514
nosy: dgan, ezio.melotti, vstinner
priority: normal
severity: normal
status: open
title: interpreter hangs forever on invalid input
type: behavior
versions: Python 3.7, Python 3.8

___
Python tracker 

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



[issue42017] Add new type in typing

2020-10-12 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
nosy: +gvanrossum, levkivskyi

___
Python tracker 

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



[issue42019] Override MagicMock special methods

2020-10-12 Thread Aristotelis Mikropoulos


New submission from Aristotelis Mikropoulos :

This is more of a question whether the following is intended behavior:
Subclassing unittest.mock.MagicMock and overriding one of the special (double 
underscore) methods has no effect. The default MagicMock method implementation 
still stands. This isn't the case with subclassing Mock.
It is understood that the purpose of MagicMock is to offer stub implementations 
of certain special methods, but isn't defining them yourself in the body of a 
subclass supposed to override those stubs?
There is an example in the file attached.

--
components: Tests
files: mockcase.py
messages: 378513
nosy: Indy
priority: normal
severity: normal
status: open
title: Override MagicMock special methods
type: behavior
versions: Python 3.9
Added file: https://bugs.python.org/file49510/mockcase.py

___
Python tracker 

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



[issue40422] Light refactor: create a common _Py_closerange API

2020-10-12 Thread Kyle Evans


Change by Kyle Evans :


--
pull_requests: +21646
stage: resolved -> patch review
pull_request: https://github.com/python/cpython/pull/22672

___
Python tracker 

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



[issue42018] winreg SetValue(Ex) should mention integer as an acceptable value

2020-10-12 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
nosy: +serhiy.storchaka
type:  -> enhancement
versions: +Python 3.10, Python 3.8

___
Python tracker 

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



[issue42018] winreg SetValue(Ex) should mention integer as an acceptable value

2020-10-12 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
components: +Windows
nosy: +paul.moore, steve.dower, tim.golden, zach.ware

___
Python tracker 

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



[issue42013] venv on Windows with symlinks is broken if invoked with -I

2020-10-12 Thread Paul Moore


Paul Moore  added the comment:

I'm inclined to think that creating a venv from within another venv should be 
allowed. Tools like pipx can result in *other* tools being run from within a 
virtual environment, and I don't think it's good to disallow that usage - as an 
example, I have virtualenv, tox and nox installed via pipx, and all of them 
create virtual environments.

So I'm +1 on fixing this by calling realpath.

I don't think we need to do anything special for --system-site-packages. The 
docs say "Give the virtual environment access to the system site-packages dir". 
If people are trying to chain venvs using it, they are misreading that comment 
- and the best they could hope for is to request that it's made clearer.

--

___
Python tracker 

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



[issue42015] Order of decrementing reference counts in meth_dealloc

2020-10-12 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Thank you Yannick for your report and PR!

--

___
Python tracker 

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



RE: What might cause my sample program to forget that already imported datetime?

2020-10-12 Thread Steve
Thank you, those two fixes took care of the problem.



Footnote:
The only time incorrectly is spelled incorrectly 
is when it is spelled "incorrectly".

-Original Message-
From: Python-list  On
Behalf Of Chris Angelico
Sent: Monday, October 12, 2020 6:37 AM
To: Python 
Subject: Re: What might cause my sample program to forget that already
imported datetime?

On Mon, Oct 12, 2020 at 9:14 PM Steve  wrote:
>
> At the top of my sample program, I have:
>
> import datetime
> from datetime import *
>
> But import datetime also has to be entered on line 21 as shown.
> The error is printed at the bottom of the code.
> Why does the code seem to forget that I have already imported datetime?
> =
> import datetime
> from datetime import *
>
> d2 =  datetime.now()
> d2i = d2.isoformat()
>
> with open("TimeDate.txt", 'r') as infile:
>  for BottleInfo in infile: # loop to find each line in the file 
> for that dose
>BottleInfo = BottleInfo.strip()
>
>if ((BottleInfo[0:3]== "LBD")):
> BottleData = BottleInfo[0:43].strip()
>
> BottleDataA = BottleData[4:14].strip() BottleDataB = 
> BottleData[16:30].strip() BottleDataC = BottleDataA + " " + 
> BottleDataB print("BottleDataC = <" + BottleDataC + ">")
> print()
> d1 = BottleDataC
>
> import datetime  #Why does this have to be here? line 21
>
> dto = datetime.datetime.strptime(d1, '%Y-%m-%d %H:%M:%S.%f') dti = 
> dto.isoformat()
>
> HoursDiff = int((d2-dto).total_seconds()/3600)
> print("HoursDiff = " + str(HoursDiff))
> print()
>
> TimeDateInfo=open("TimeDate.txt", "a") TimeDateInfo.write("{0:>5} 
> {1:>25} {2:>5}\n".format ("LBD", d2i, HoursDiff))
> TimeDateInfo.close()
>
> print("Done")
>
> """
> This is the error I get if I comment out line 21:
>
> Traceback (most recent call last):
>   File "F:/Med Insulin codes A/A TEST 10-07-2020/ReadWriteTimeDate 
> POSIX Samplea.py", line 38, in 
> dto = datetime.datetime.strptime(d1, '%Y-%m-%d %H:%M:%S.%f')
> AttributeError: type object 'datetime.datetime' has no attribute
'datetime'
> """
> This code will be copied into another program as a function and the 
> presence of import datetime in line 21 causes another error.
>

The issue here is that you've done two different imports at the top:

import datetime
from datetime import *

These are incompatible with each other, so you're going to get issues.
I'd recommend doing just the first one, and then identifying d2 as
datetime.datetime.now() instead.

ChrisA
--
https://mail.python.org/mailman/listinfo/python-list

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Truncation error

2020-10-12 Thread Peter J. Holzer
On 2020-10-11 01:40:42 -, Grant Edwards wrote:
> On 2020-10-10, Peter J. Holzer  wrote:
> > On 2020-10-07 07:53:55 +0200, Marco Sulla wrote:
> >> If you want to avoid float problems, you can use Decimal:
> >
> > Decimal doesn't avoid floating point problems, because it is a floating
> > point format. For example:
> > [...]
> 
> > >>> from decimal import *
> > >>> a = Decimal(3)
> > >>> a
> > Decimal('3')
> > >>> b = Decimal(1E50)
> > >>> b
> > Decimal('17629769841091887003294964970946560')
> > [...]
> 
> There are two problems with your code:
> 
>  1. You meant Decimal('1e50').

No. I meant Decimal(1E50)

>  What you typed creates a Decimal value
> from the IEEE 64-bit floating point value closest to 1e50.

Which is what I wanted. I gave me some "random" digits at the end
without having to type them. But I realize that I should have used
Decimal('1e50') to remove that red herring - the problem can be
demonstrated with Decimal('1e50') just as well, it's just less
spectacular. (OTOH using Decimal(1E50) has the advantage of
demonstrating the dangers of mixing operands of different precision, but
again, that may just be confusing).


>  2. You need to increase the context precision.  It defaults to 28,
> and you're example needs it to be at least 51:

That helps for that specific example, but not in general.
> 
> >>> getcontext().prec = 100

So then maybe there is an operand with 150 digits. Or you want to add
1E70 to 1E-70.

The fact is that any non-trivial computation will always exceed the
precision (even a simple division like Decimal('1') / Decimal('3') needs
an infinite number of digits, but you can't set precision to infinite)
and require rounding. You can make the error very small, but it will
still be there. You have to be aware of that. Using Decimal will not
give you mathematically correct results - it will just give you
different (und usually, but not always, as I've demonstrated) errors.

hp

-- 
   _  | Peter J. Holzer| Story must make more sense than reality.
|_|_) ||
| |   | h...@hjp.at |-- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |   challenge!"


signature.asc
Description: PGP signature
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue41561] test_ssl fails in Ubuntu 20.04: test_min_max_version_mismatch

2020-10-12 Thread Bug Reporter


Bug Reporter  added the comment:

I got an advice and posted the question at 
https://answers.launchpad.net/ubuntu/+source/openssl/+question/693423

--

___
Python tracker 

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



Re: Truncation error

2020-10-12 Thread Peter J. Holzer
On 2020-10-10 13:31:34 -0400, Dennis Lee Bieber wrote:
> On Sat, 10 Oct 2020 17:58:34 +0200, "Peter J. Holzer" 
> declaimed the following:
> 
> >On 2020-10-07 07:53:55 +0200, Marco Sulla wrote:
> >> If you want to avoid float problems, you can use Decimal:
> >
> >Decimal doesn't avoid floating point problems, because it is a floating
> >point format. For example:
> >
> 
> >>>> b = Decimal(1E50)
> >>>> b
> >Decimal('17629769841091887003294964970946560')
> 
>   That one's a red herring... The "problem" occurs with the 1E50 /float/
> before conversion to decimal

No. At least not the problem I wanted to demonstrate which is that like
any floating-point format, Decimal has limited precision and hence 
A + B - A is in general not equal to B.

I could have written 
b = Decimal('17629769841091887003294964970946560')
instead, but b = Decimal(1E50) was less to type.
Also, with Decimal('1E150') the result is less spectacular, but also
wrong.

Decimal is especially devious here, because while it will happily store
a value with 51 digits, it will round results of operations to the
configured precision. So by mixing operands with different precision you
get results which are very hard to predict.

At least with float you know the precision[1], so you can reason about the
results.

hp

[1] This is actually not always true. Some architectures (like x87) use
a higher precision for intermediate results, which is generally
good but makes it really hard to estimate errors unless you know
exactly what code the compiler generates.

-- 
   _  | Peter J. Holzer| Story must make more sense than reality.
|_|_) ||
| |   | h...@hjp.at |-- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |   challenge!"


signature.asc
Description: PGP signature
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue34976] IDLE: Replace the search dialog with a search bar

2020-10-12 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Notepad++, which I use, uses a tabbed dialog for search and replace, which I 
think I would like to somewhat imitate.  Or just have one search and replace 
dialog.  I need to experiment.  I don't like the Firefox toolbar and consider 
it buggy.  In any case, it and browsers in general do not do replace.  Maybe 
yours is better.

--

___
Python tracker 

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



[issue35155] Clarify Protocol Handlers in urllib.request Docs

2020-10-12 Thread Terry J. Reedy


Change by Terry J. Reedy :


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

___
Python tracker 

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



[issue42017] Add new type in typing

2020-10-12 Thread ThatXliner


Change by ThatXliner :


--
versions: +Python 3.9 -Python 3.10

___
Python tracker 

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



[issue42017] Add new type in typing

2020-10-12 Thread ThatXliner


Change by ThatXliner :


--
versions: +Python 3.10

___
Python tracker 

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



[issue42018] winreg SetValue(Ex) should mention integer as an acceptable value

2020-10-12 Thread Roundup Robot


Change by Roundup Robot :


--
keywords: +patch
nosy: +python-dev
nosy_count: 2.0 -> 3.0
pull_requests: +21644
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/22671

___
Python tracker 

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



[issue42018] winreg SetValue(Ex) should mention integer as an acceptable value

2020-10-12 Thread Kevin Wojniak


New submission from Kevin Wojniak :

On https://docs.python.org/3/library/winreg.html

For SetValue and SetValueEx is says:

> value is a string that specifies the new value.

but value can also be an integer if the type is DWORD. Here's a test that shows 
that: https://github.com/python/cpython/blob/3.9/Lib/test/test_winreg.py#L339

Suggested update:

> value is a string or integer that specifies the new value.

--
assignee: docs@python
components: Documentation
messages: 378508
nosy: docs@python, kwojniak_box
priority: normal
severity: normal
status: open
title: winreg SetValue(Ex) should mention integer as an acceptable value
versions: Python 3.9

___
Python tracker 

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



[issue42013] venv on Windows with symlinks is broken if invoked with -I

2020-10-12 Thread Steve Dower


Steve Dower  added the comment:

Thanks for figuring that out, Eryk.

Probably we should just update venv to do a realpath(sys._base_executable) to 
handle the venv-from-symlinked-venv scenario.

Though I'd also be quite happy to just disallow that entirely (as we used to?). 
If you enable system site packages thinking you're chaining venvs together, you 
may be surprised, so it might just be better to error out here. (On the *other* 
hand, if you're programmatically invoking venv, maybe you know what you're 
doing and we should allow it?)

--

___
Python tracker 

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



[issue42015] Order of decrementing reference counts in meth_dealloc

2020-10-12 Thread Yannick Jadoul


Yannick Jadoul  added the comment:

Yes, sorry for the delay; I got caught up in something else.

Meanwhile, https://github.com/python/cpython/pull/22670 should solve our 
issues. I think Henry confirmed this locally?

--

___
Python tracker 

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



[issue42015] Order of decrementing reference counts in meth_dealloc

2020-10-12 Thread Yannick Jadoul


Change by Yannick Jadoul :


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

___
Python tracker 

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



[issue42017] Add new type in typing

2020-10-12 Thread ThatXliner


New submission from ThatXliner :

Because there is a typing.AnyStr (which is equal to AnyStr = TypeVar("AnyStr", 
str, bytes)), I think there should be a AnyNum which is equivalent to

from decimal import Decimal
from fractions import Fraction
AnyNum = TypeVar("AnyNum", int, float, complex, Decimal, Fraction)

--
components: Library (Lib)
messages: 378505
nosy: ThatXliner
priority: normal
severity: normal
status: open
title: Add new type in typing
type: enhancement
versions: Python 3.10

___
Python tracker 

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



[issue21927] BOM appears in stdin when using Powershell

2020-10-12 Thread Jason R. Coombs


Jason R. Coombs  added the comment:

Thanks Eryk for following up. Glad to hear the issue has been fixed upstream!

--

___
Python tracker 

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



[issue42016] Add ksh to venv examples

2020-10-12 Thread Fibonacci


New submission from Fibonacci :

Add an example on how to source with the korn shell (tested on OpenBSD). Maybe 
the bash/zsh example can be changed to use the dot to source the file, then it 
could be included there.

Diff attached.

--
assignee: docs@python
components: Documentation
files: python_venv_ksh
messages: 378504
nosy: docs@python, fibonacci
priority: normal
severity: normal
status: open
title: Add ksh to venv examples
type: enhancement
Added file: https://bugs.python.org/file49509/python_venv_ksh

___
Python tracker 

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



[issue42015] Order of decrementing reference counts in meth_dealloc

2020-10-12 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Do you mind to create a PR Yannick?

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue42015] Order of decrementing reference counts in meth_dealloc

2020-10-12 Thread Henry Schreiner


Change by Henry Schreiner :


--
nosy: +Henry Schreiner

___
Python tracker 

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



[issue42011] Documentation for logging.Filter.filter reports the wrong return type

2020-10-12 Thread Vinay Sajip


Change by Vinay Sajip :


--
versions:  -Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

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



[issue42011] Documentation for logging.Filter.filter reports the wrong return type

2020-10-12 Thread Vinay Sajip


Vinay Sajip  added the comment:

I agree that the documentation now should use Booleans rather than ints for the 
return type. It's a hangover from the pre-bool days of Python 1.5.2 ...

> P.S. As a side note, the API for filter() is quite counter-intuitive

That depends on if you consider the "filter" operation as "filter in" or 
"filter out", but the documentation is clear on what needs to be returned for a 
particular outcome.

--

___
Python tracker 

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



[issue42015] Order of decrementing reference counts in meth_dealloc

2020-10-12 Thread Yannick Jadoul


New submission from Yannick Jadoul :

In Python 3.9, the line `Py_XDECREF(PyCFunction_GET_CLASS(m));` was added to 
`meth_dealloc` (in `methodobject.c`). Unfortunately for pybind11, it's inserted 
exactly two lines too low, since it accesses the `PyMethodDef` and we store the 
`PyMethodDef` instance in the capsule that's used as `self`-argument of the 
`PyCFunction`.

Result: UB, since `Py_XDECREF(m->m_self);` brings down the refcount of the 
capsule to 0 and (indirectly) frees the `PyMethodDef`, while its contents are 
now still accessed.

>From the pybind11 perspective, it would be optimal if this could be fixed in 
>CPython itself, by moving up this one `Py_XDECREF` 2 lines. This would a) be 
>more efficient than creating a workaround, and b) allow old, existing versions 
>of pybind11 to work with Python 3.9 (well, 3.9.1, then, hopefully); the user 
>base of pybind11 has grown quite a bit and now includes giants like scipy or 
>some Google libraries.
I will make a PR implementing this, soon.

If there's a different, recommended way of creating these `PyCFunctionObject`s 
dynamically and cleaning up the `PyMethodDef`, we'd be interested as well, to 
make sure these kinds of breakages are avoided in the future.

Apologies for only figuring out now how to debug this, using valgrind. Up until 
yesterday, we only saw some failures in CI on macOS, but it was hard to 
reproduce and debug locally.


- Related issue: https://bugs.python.org/issue41237
- pybind11 issue: https://github.com/pybind/pybind11/issues/2558
- pybind11 PR: https://github.com/pybind/pybind11/pull/2576

--
components: C API, Interpreter Core
messages: 378500
nosy: YannickJadoul
priority: normal
severity: normal
status: open
title: Order of decrementing reference counts in meth_dealloc
type: crash
versions: Python 3.10, Python 3.9

___
Python tracker 

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



[issue42013] venv on Windows with symlinks is broken if invoked with -I

2020-10-12 Thread Eryk Sun


Eryk Sun  added the comment:

This issue is partly due to bpo-8901, which changed the behavior of the -E and 
-I command-line options to make them ignore the default PythonPath value in the 
registry key "Software\Python\PythonCore\X.Y\PythonPath". The change itself is 
not wrong. It's just exposing an underlying problem.

The `home` path in pyvenv.cfg is from sys._base_executable. In a launcher-based 
environment that's created from the base installation, sys._base_executable is 
the real base executable. OTOH, in a symlink-based virtual environment, 
sys._base_executable is the same as sys.executable. Consequently, if a virtual 
environment is created from a symlink-based virtual environment, the `home` 
path in pyvenv.cfg refers to the creating environment instead of the base 
installation. In this case, with the current implementation, the standard 
library can only be found by falling back on the default PythonPath in the 
registry.

--

___
Python tracker 

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



[issue42004] Allow uploading files with SimpleHTTPRequestHandler

2020-10-12 Thread Javier Ayres


Javier Ayres  added the comment:

I see. To be honest I didn't know FieldStorage at all, it was the best way I 
found of dealing with file data in requests using just the standard library. If 
you think this feature makes sense and it could be included, I could look into 
removing the FieldStorage dependency.

--

___
Python tracker 

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



[issue40422] Light refactor: create a common _Py_closerange API

2020-10-12 Thread Kyle Evans


Kyle Evans  added the comment:

Excellent, thank you.

--

___
Python tracker 

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



Re: What might cause my sample program to forget that already imported datetime?

2020-10-12 Thread Richard Damon
On 10/12/20 7:20 AM, Chris Angelico wrote:
> On Mon, Oct 12, 2020 at 9:58 PM Abdur-Rahmaan Janhangeer
>  wrote:
>> Btw why a datetime in datetime?
>>
>> It causes much confusion. I dont know
>> the design decision behind, if someone knows, it might be good to explain
>>
> There are quite a few modules that have one "most obvious" entrypoint,
> and there's really no better name for either that thing or the module
> it lives in. The pprint module has a pprint function, giving the same
> phenomenon.
>
> This is yet another reason that "from MODULE import *" is a bad idea.
> Instead, just import the module itself, and take whatever you need.
>
> ChrisA

And if you don't like doing datetime.datatime all the time, you can also do

from MODULE import SYMBOL

and do

from MODULE import SYMBOL as ALIAS

when you get conflicts.

The big issue is that you lose control with * as it pulls 'arbitrary'
things into your name space.

I do sometimes do things like the combination

import MODULE

from MODULE import SYMBOL

if there is some name in the module I want to use a lot.

I don't see much need for:

import MODULE

from MODULE import *

as if you are bringing in ALL the names into the current module name
space, when will you need to use the module.symbol notation?

-- 
Richard Damon

-- 
https://mail.python.org/mailman/listinfo/python-list


[issue41282] Deprecate and remove distutils

2020-10-12 Thread Filipe Laíns

Change by Filipe Laíns :


--
nosy: +FFY00

___
Python tracker 

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



[issue42011] Documentation for logging.Filter.filter reports the wrong return type

2020-10-12 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +vinay.sajip

___
Python tracker 

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



[issue42007] Line continuation after Boolean operation

2020-10-12 Thread Eric V. Smith


Eric V. Smith  added the comment:

Agreed that this isn't likely to change.

If you have a concrete proposal for how the language parsing rules would change 
in order to support this, you should post it to the python-ideas mailing list.

If that discussion results in a consensus, then we can re-open this issue. But 
unless you have a very compelling rationale, I don't expect any language 
changes here.

--
nosy: +eric.smith
resolution:  -> rejected
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue41977] ctypes array inside structure requires explicit garbage collection

2020-10-12 Thread Filipe Laíns

Change by Filipe Laíns :


--
nosy: +FFY00

___
Python tracker 

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



[issue42014] shutil.rmtree calls onerror with different function than failed

2020-10-12 Thread Michal Čihař

New submission from Michal Čihař :

The onerror callback is called with os.lstat when the actual failing function 
is os.open.

To reproduce create directory that can not be listed:

import os
import shutil

def onerror(func, path, exc_info):
print(func)

os.mkdir("test")
os.chmod("test", 0)
shutil.rmtree("test", onerror=onerror)

--
components: Library (Lib)
messages: 378495
nosy: nijel
priority: normal
pull_requests: 21642
severity: normal
status: open
title: shutil.rmtree calls onerror with different function than failed
type: behavior
versions: Python 3.10, Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 
3.9

___
Python tracker 

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



[issue41990] venv module clashes with pip --user ... improve coordination.

2020-10-12 Thread Filipe Laíns

Change by Filipe Laíns :


--
nosy: +FFY00

___
Python tracker 

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



[issue39679] functools: singledispatchmethod doesn't work with classmethod

2020-10-12 Thread Filipe Laíns

Change by Filipe Laíns :


--
nosy: +FFY00

___
Python tracker 

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



[issue42013] venv on Windows with symlinks is broken if invoked with -I

2020-10-12 Thread Eryk Sun


Change by Eryk Sun :


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

___
Python tracker 

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



[issue42013] venv on Windows with symlinks is broken if invoked with -I

2020-10-12 Thread Eryk Sun


Eryk Sun  added the comment:

> Well, actually the environment variables /should/ not matter as -I 
> implies -E.

The operative word there is "should". I was grasping for anything that might 
explain why I couldn't reproduce the issue.

> Ok, the missing link is that the python you run into needs to 
> be also a symlink venv

Thank you, that reproduces the problem for me.

--

___
Python tracker 

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



[issue42013] venv on Windows with symlinks is broken if invoked with -I

2020-10-12 Thread Bernat Gabor


Bernat Gabor  added the comment:

> We need more information about the specific environment this is triggering.

Both Gitub Actions Windows CPython3.9 or installer as downloaded from (on 
Windows 10) https://www.python.org/downloads/release/python-390/.

> PYTHONHOME should not be set all. PYTHONPATH needs to be set carefully. It 
> should never include standard-library path

The issue manifests independent of those environment variables, netiher of them 
are set.

--

___
Python tracker 

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



[issue42013] venv on Windows with symlinks is broken if invoked with -I

2020-10-12 Thread Bernat Gabor

Bernat Gabor  added the comment:

Ok, the missing link is that the python you run into needs to be also a symlink 
venv:

❯ py -m venv env --without-pip --clear --symlinks
❯ .\env\Scripts\python.exe -c "import venv, subprocess; 
venv.EnvBuilder(with_pip=False, symlinks=True).create('venv'); 
subprocess.check_call(['venv\\Scripts\\python.exe', '-Ic', 'import sys; 
print(sys.executable)'])"

Fatal Python error: init_fs_encoding: failed to get the Python codec of the 
filesystem encoding
Python runtime state: core initialized
ModuleNotFoundError: No module named 'encodings'

--
nosy:  -FFY00

___
Python tracker 

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



[issue42013] venv on Windows with symlinks is broken if invoked with -I

2020-10-12 Thread Filipe Laíns

Filipe Laíns  added the comment:

Well, actually the environment variables /should/ not matter as -I implies -E.

--

___
Python tracker 

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



[issue42013] venv on Windows with symlinks is broken if invoked with -I

2020-10-12 Thread Filipe Laíns

Filipe Laíns  added the comment:

This error most likely happens because sys.path isn't being set properly and 
the standard library isn't being included.

We need more information about the specific environment this is triggering.

Which CPython build are you using? The one from Github Actions, right?
We also need the environment variables.

--
nosy: +FFY00

___
Python tracker 

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



[issue42013] venv on Windows with symlinks is broken if invoked with -I

2020-10-12 Thread Eryk Sun


Eryk Sun  added the comment:

What about the PYTHONHOME and PYTHONPATH environment variables?

>>> 'PYTHONHOME' in os.environ
False
>>> 'PYTHONPATH' in os.environ
False

PYTHONHOME should not be set all. PYTHONPATH needs to be set carefully. It 
should never include standard-library paths.

--

___
Python tracker 

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



[issue42013] venv on Windows with symlinks is broken if invoked with -I

2020-10-12 Thread Bernat Gabor

Bernat Gabor  added the comment:

❯ py -c 'import sys; print(sys.version)'
3.9.0 (tags/v3.9.0:9cf6752, Oct  5 2020, 15:34:40) [MSC v.1927 64 bit (AMD64)]

--

___
Python tracker 

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



[issue42013] venv on Windows with symlinks is broken if invoked with -I

2020-10-12 Thread Eryk Sun


Eryk Sun  added the comment:

I can't reproduce the issue with the normal 3.9.0 distribution from python.org. 
For example:

>>> venv.EnvBuilder(with_pip=False, symlinks=True).create("venv")
>>> subprocess.check_call(["venv\\Scripts\\python.exe", "-Ic", "import sys; 
print(sys.executable)"])
C:\Temp\env\venv\Scripts\python.exe
0

Which Python version(s) and distribution(s) did you test? Do you have the 
PYTHONHOME and/or PYTHONPATH environment variables set?

--
nosy: +eryksun

___
Python tracker 

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



[issue38912] test_asyncio altered the execution environment

2020-10-12 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
nosy: +aeros

___
Python tracker 

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



[issue21927] BOM appears in stdin when using Powershell

2020-10-12 Thread Eryk Sun

Eryk Sun  added the comment:

I'm closing this as a third-party issue with older versions of PowerShell. 
Newer versions of PowerShell set the output encoding to UTF-8 without a BOM 
preamble. For example:

PS C:\> $PSVersionTable.PSVersion

Major  Minor  Patch  PreReleaseLabel BuildLabel
-  -  -  --- --
7  0  3

PS C:\> $OutputEncoding.EncodingName
Unicode (UTF-8)

PS C:\> echo ¡¢£¤¥ | py -3 -X utf8 -c "print(ascii(input()))"
'\xa1\xa2\xa3\xa4\xa5'

It's still possible to manually set the output encoding to include a BOM 
preamble. For example:

PS C:\> $OutputEncoding = [System.Text.Encoding]::UTF8
PS C:\> $OutputEncoding.GetPreamble()
239
187
191
PS C:\> echo ¡¢£¤¥ | py -3 -X utf8 -c "print(ascii(input()))"
'\ufeff\xa1\xa2\xa3\xa4\xa5'

I don't know what would be appropriate for Python's I/O stack in terms of 
detecting and handling a UTF-8 preamble on any type of file (console/terminal, 
pipe, disk), i.e. using the "utf-8-sig" encoding instead of "utf-8", as opposed 
to just letting scripts detect and handle an initial BOM character (U+FEFF) 
however they see fit. But that discussion needs a new issue if people are 
interested in supporting new behavior.

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

___
Python tracker 

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



Re: Embedding version in command-line program

2020-10-12 Thread Loris Bennett
Hi Heinrich,

Heinrich Kruger  writes:

> ‐‐‐ Original Message ‐‐‐
> On Thursday, October 8, 2020 2:00 PM, Loris Bennett 
>  wrote:
>
>> Marco Sulla marco.sulla.pyt...@gmail.com writes:
>>
>> > On Wed, 7 Oct 2020 at 14:16, Loris Bennett loris.benn...@fu-berlin.de
>> > wrote:
>> >
>> > > But the toml file isn't part of the distribution and so it won't be
>> > > installed.
>> > > I suppose I could write a separate program which parses the toml file
>> > > and then just injects the version into init.py.
>> >
>> > Yes, I do not know poetry, but I suppose you can generate it in its
>> > setup. I usually create a separate VERSION file and I read it in
>> > init.py. Other people creates a version.py that is evaled inside
>> > init.py
>>
>> I ended up using the module
>>
>> poetry_version
>>
>> which allows one to extract the version like this:
>>
>> import poetry_version
>>
>> version = poetry_version.extract(source_file=file)
>>
>
> It looks to me like that package also just reads the pyproject.toml file.
>
> You could try using the "importlib.metadata" module
> (https://docs.python.org/3.8/library/importlib.metadata.html). If you're still
> using python 3.7 (or older) you can install importlib-metadata from PyPI
> (https://pypi.org/project/importlib-metadata/).
>
> Try putting something like
>
> ```
> from importlib import metadata
>
> __version__ = metadata.version(__name__)
> ```
> in your __init__.py file.
>
> Then you can do something like:
> ```
> from . import __version__
>
> def main():
> print(f"Version: {__version__}")
> ```
>
> Bear in mind that this would only work if your package is installed (e.g. in
> virtual environment). Otherwise the `metadata.version(__name__)` call will 
> fail
> with a `importlib.metadata.PackageNotFoundError` exception (of course you 
> could
> catch that and fall back to trying to read the pyproject.toml file).

You're right of course, that 'poetry_version' just looks at the toml file.

I'm using Python 3.6, so I had to do

  import importlib_metadata as metadata

which works, although as you mention in you caveat, it is a bit of a
pain that this gives me the version of the installed version.

As someone who has only dabbled in Python up to know, I'm slightly
surprised that there is no obvious and accepted way of keeping the
version in the metadata of a module and the version which a command-line
wrapper around the module in sync.  Is my expectation that this should
be straightforward misguided?

At the least I would have expected that, since poetry regards
the toml file as the primary source of project data, although it isn't
part of the installed package, that the 'poetry version' command would
offer the option of bumping the version directly in the code.

Cheers,

Loris

-- 
This signature is currently under construction.
-- 
https://mail.python.org/mailman/listinfo/python-list


MERGE SQL in cx_Oracle executemany

2020-10-12 Thread Naveen Roy Vikkram
Hi there,

I'm looking to insert values into an oracle table (my_table) using the query 
below. The insert query works when the PROJECT is not NULL/empty (""). However 
when PROJECT is an empty string(''), the query creates a new duplicate row 
every time the code is executed (with project value populating as null). I 
would like to modify my query so a new row is not inserted when all column 
values are matched (including when project code is null). 
I'm guessing I would need to include a "when matched" statement, but not too 
sure on how to get this going. Would appreciate help with this, thanks.

```
con = cx_Oracle.connect(connstr)
cur = con.cursor()
rows = [tuple(x) for x in df.values]
cur3.executemany('''merge into my_table
using dual
on (YEAR = :1 and QUARTER = :2 and CODE = :3 and AMOUNT = :4 and DATE = :5 and 
COMMENTS = :6 and PROJECT = :7)
when not matched then insert values (:1, :2, :3, :4, :5, :6, :7)
''',rows)
con.commit()
cur.close()
con.close()
```
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue42008] Internal Random class calling seed() with incorrect argument

2020-10-12 Thread Amir Mohamadi


Change by Amir Mohamadi :


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

___
Python tracker 

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



Your experience of backtacking during a pip install

2020-10-12 Thread Bernard Tyers - Sane UX Design
Hello there,

The pip team is implementing some improvements to pip's output to deal
with situations where, during a `pip install`, it needs to backtrack on
package(s).

To do this we need to make some decisions. We'd appreciate your input
using this very short (1 question!) poll:

https://saneuxdesign.survey.fm/your-experience-of-pip-backtracking


To follow the implementation discussion, see it here:

https://github.com/pypa/pip/issues/8975


best wishes,

Bernard

-- Bernard Tyers UX Designer, pip Team User Researcher & Interaction
Designer | Sane UX Design PGP Key: https://keybase.io/ei8fdb

-- 

Bernard Tyers, User Researcher & Interaction Designer

Sane UX Design | PGP Key: https://keybase.io/ei8fdb

I am currently working with the Python Software Foundation and Reset.tech

I work on User Centred Design, Open Source Software, and user privacy.

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: What might cause my sample program to forget that already imported datetime?

2020-10-12 Thread Chris Angelico
On Mon, Oct 12, 2020 at 9:58 PM Abdur-Rahmaan Janhangeer
 wrote:
>
> Btw why a datetime in datetime?
>
> It causes much confusion. I dont know
> the design decision behind, if someone knows, it might be good to explain
>

There are quite a few modules that have one "most obvious" entrypoint,
and there's really no better name for either that thing or the module
it lives in. The pprint module has a pprint function, giving the same
phenomenon.

This is yet another reason that "from MODULE import *" is a bad idea.
Instead, just import the module itself, and take whatever you need.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: What might cause my sample program to forget that already imported datetime?

2020-10-12 Thread Abdur-Rahmaan Janhangeer
Btw why a datetime in datetime?

It causes much confusion. I dont know
the design decision behind, if someone knows, it might be good to explain

I dont expect it to change anytime soon
due to backward compatibility, but just
for knowledge.

Kind Regards,


Abdur-Rahmaan Janhangeer

https://www.github.com/Abdur-RahmaanJ

Mauritius

sent from gmail client on Android, that's why the signature is so ugly.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue42013] venv on Windows with symlinks is broken if invoked with -I

2020-10-12 Thread Bernat Gabor


Change by Bernat Gabor :


--
components: +Windows
nosy: +paul.moore, steve.dower, tim.golden, zach.ware

___
Python tracker 

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



[issue42013] venv on Windows with symlinks is broken if invoked with -I

2020-10-12 Thread Bernat Gabor


New submission from Bernat Gabor :

Here's a small reproducible, run it on a Windows OS that has symlinks enabled:

import shutil
import venv
import subprocess

shutil.rmtree("venv", ignore_errors=True)
venv.EnvBuilder(with_pip=False, symlinks=True).create("venv")

# works
subprocess.check_call(["venv\\Scripts\\python.exe", "-c", "import sys; 
print(sys.executable)"])

# fails with No module named 'encodings'
subprocess.check_call(["venv\\Scripts\\python.exe", "-Ic", "import sys; 
print(sys.executable)"])

--
messages: 378485
nosy: gaborjbernat
priority: normal
severity: normal
status: open
title: venv on Windows with symlinks is broken if invoked with -I
versions: Python 3.10, Python 3.9

___
Python tracker 

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



  1   2   >