[issue41883] ctypes pointee goes out of scope, then pointer in struct dangles and crashes

2020-09-28 Thread Eryk Sun


Eryk Sun  added the comment:

I think this is a numpy issue. Its data_as() method doesn't support the ctypes 
_objects protocol to keep the numpy array referenced by subsequently created 
ctypes objects. For example:

import ctypes
import numpy as np

dtype = ctypes.c_double
ptype = ctypes.POINTER(dtype)

class array_struct(ctypes.Structure):
_fields_ = (('dim1', ctypes.c_int),
('dim2', ctypes.c_int),
('ptr', ptype))

n = 12
m = 50
a = np.ones((n, m), dtype=dtype)
p = a.ctypes.data_as(ptype)

data_as() is implemented as a cast() of the ctypes._data pointer. This is a 
c_void_p instance for the base address of the numpy array, but it doesn't 
reference the numpy array object itself. The pointer returned by cast() 
references this _data pointer in its _objects:

>>> p._objects
{139993690976448: c_void_p(42270224)}

data_as() also sets a reference to the numpy array object as a non-ctypes _arr 
attribute:

>>> p._arr is a
True

This _arr attribute keeps the array referenced for the particular instance, but 
ctypes isn't aware of it. When the object returned by data_as() is set in a 
struct, ctypes only carries forward the c_void_p reference from _objects that 
it's aware of:

>>> a_wrap1 = array_struct(n, m, p)
>>> a_wrap1._objects
{'2': {139993690976448: c_void_p(42270224)}}

It would be sufficient to keep the numpy array alive if this c_void_p instance 
referenced the array, but it doesn't. Alternatively, data_as() could update the 
_objects dict to reference the array. For example:

>>> p._objects['1'] = a
>>> a_wrap2 = array_struct(n, m, p)
>>> a_wrap2._objects['2']['1'] is a
True

--
nosy: +eryksun

___
Python tracker 

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



[issue41774] While removing element from list using for and remove(), which has same items output is not right

2020-09-28 Thread miss-islington


miss-islington  added the comment:


New changeset 868c8e41eb1d7dc032679ae06e62c0d60edd7725 by Miss Islington (bot) 
in branch '3.9':
bpo-41774: Add programming FAQ entry (GH-22402)
https://github.com/python/cpython/commit/868c8e41eb1d7dc032679ae06e62c0d60edd7725


--

___
Python tracker 

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



[issue41774] While removing element from list using for and remove(), which has same items output is not right

2020-09-28 Thread miss-islington


miss-islington  added the comment:


New changeset d50a0700265536a20bcce3fb108c954746d97625 by Miss Islington (bot) 
in branch '3.8':
bpo-41774: Add programming FAQ entry (GH-22402)
https://github.com/python/cpython/commit/d50a0700265536a20bcce3fb108c954746d97625


--

___
Python tracker 

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



[issue41774] While removing element from list using for and remove(), which has same items output is not right

2020-09-28 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 6.0 -> 7.0
pull_requests: +21477
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/22447

___
Python tracker 

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



[issue41774] While removing element from list using for and remove(), which has same items output is not right

2020-09-28 Thread miss-islington


Change by miss-islington :


--
pull_requests: +21478
pull_request: https://github.com/python/cpython/pull/22448

___
Python tracker 

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



[issue41774] While removing element from list using for and remove(), which has same items output is not right

2020-09-28 Thread Terry J. Reedy


Terry J. Reedy  added the comment:


New changeset 5b0181d1f6474c2cb9b80bdaf3bc56a78bf5fbe7 by Terry Jan Reedy in 
branch 'master':
bpo-41774: Add programming FAQ entry (GH-22402)
https://github.com/python/cpython/commit/5b0181d1f6474c2cb9b80bdaf3bc56a78bf5fbe7


--

___
Python tracker 

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



[issue41878] python3 fails to use custom mapping object as symbols in eval()

2020-09-28 Thread Robert Haschke


Robert Haschke  added the comment:

Looks like the list generator is considered as a new nested scope, which 
prohibits access to local variables?
This basic expression, passing local symbols only, fails as well:

eval('[abc[i]*abc[i] for i in [0, 1, 2]]', {}, dict(abc=[1, 2, 3]))

while this one, passing dict as global symbols, works:

eval('[abc[i]*abc[i] for i in [0, 1, 2]]', dict(abc=[1, 2, 3]))

However, passing globals must be a real dict. So I cannot simply pass my custom 
mapping to globals.

--
title: python3 fails to use custom dict-like object as symbols in eval() -> 
python3 fails to use custom mapping object as symbols in eval()

___
Python tracker 

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



[issue41883] ctypes pointee goes out of scope, then pointer in struct dangles and crashes

2020-09-28 Thread Ian M. Hoffman


New submission from Ian M. Hoffman :

A description of the problem, complete example code for reproducing it, and a 
work-around are available on SO at the link:

https://stackoverflow.com/questions/64083376/python-memory-corruption-after-successful-return-from-a-ctypes-foreign-function

In summary: (1) create an array within a Python function, (2) create a 
ctypes.Structure with a pointer to that array, (3) return that struct from the 
Python function, (4) pass the struct out and back to a foreign function, (5) 
Python can successfully dereference the return from the foreign function, then 
(6) Python crashes.

As far as I can tell, when the array in the function goes out of scope at the 
end of the function, the pointer to it in the struct becomes dangling ... but 
the dangling doesn't catch up with Python until the very end when the Python 
struct finally goes out of scope in Python and the GC can't find its pointee.

I've reproduced this on Windows and linux with gcc- and MSVC-compiled Python 
3.6 and 3.8.

Perhaps it is not good practice on my part to have let the array go out of 
scope, but perhaps a warning from Python (or at least some internal awareness 
that the memory is no longer addressed) is in order so that Python doesn't 
crash upon failing to free it.

This may be related to #39217; I can't tell.

--
components: ctypes
messages: 377652
nosy: NankerPhelge
priority: normal
severity: normal
status: open
title: ctypes pointee goes out of scope, then pointer in struct dangles and 
crashes
type: crash
versions: Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

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



Re: Use of a variable in parent loop

2020-09-28 Thread 황병희
Stephane Tougard  writes:

> ...
> It's normal, he was an ass. When I manage a team, I don't enforce tools
> or language, I ask them to work the best way they can to get the things
> done. If they want to write C in Perl (as I often do), I'm happy. If
> they prefer Ruby (that I never learnt), or Lisp ... as long as it works
> and they are able to maintain it, I'm happy as well.
>
> Nothing is more enjoyable than a platform running a variety of languages
> and technologies, working all together.
>
> And FYI, I've done this way since 25 years and I count a few good
> success in my career. Practically, my way of doing things works is at least
> as well as any.

Maybe you seems like lisp or emacs lisp just i think, not serious...

Sincerely, Byung-Hee from South Korea

-- 
^고맙습니다 _白衣從軍_ 감사합니다_^))//
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue41879] Outdated description of async iterables in documentation of async for statement

2020-09-28 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
components: +asyncio
nosy: +asvetlov, yselivanov

___
Python tracker 

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



[issue41881] New Line escape issue in raw strings

2020-09-28 Thread Kevin Ardath


Change by Kevin Ardath :


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

___
Python tracker 

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



[issue41773] Clarify handling of infinity and nan in random.choices

2020-09-28 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Thanks for the PR and for filing the issue.

--
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



[issue41773] Clarify handling of infinity and nan in random.choices

2020-09-28 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset b0dfc7581697f20385813582de7e92ba6ba0105f by Ram Rachum in branch 
'master':
bpo-41773: Raise exception for non-finite weights in random.choices().  
(GH-22441)
https://github.com/python/cpython/commit/b0dfc7581697f20385813582de7e92ba6ba0105f


--

___
Python tracker 

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



Re: Use of a variable in parent loop

2020-09-28 Thread Python
On Sun, Sep 27, 2020 at 03:18:44PM +0800, Stephane Tougard via Python-list 
wrote:
> On 2020-09-27, 2qdxy4rzwzuui...@potatochowder.com 
> <2qdxy4rzwzuui...@potatochowder.com> wrote:
> > As ChrisA noted, Python almost always Just Works without declarations.
> > If you find yourself with a lot of global and/or nonlocal statements,
> > perhaps you're [still] thinking in another language.
> 
> 
> I don't really agree with that, trying to use an undeclared
> object/variable/whatever :
> 
> Python 3.7.7 (default, Aug 22 2020, 17:07:43) 
> [GCC 7.4.0] on netbsd9
> Type "help", "copyright", "credits" or "license" for more information.
> >>> print(name)
> Traceback (most recent call last):
>   File "", line 1, in 
>   NameError: name 'name' is not defined
>   >>> 
> 
> You can say it's not the "declaration" the issue, it's the "definition",
> that's just a matter of vocabulary and it does not answer the question.

No it's not... those two words mean different things, and the
difference actually matters.  If you use strict in perl you need BOTH
(at least, if you want your variable to actually have a value):

  my $foo;
  $foo = 1;

The declaration and definition serve different purposes.  You can
combine them into one statement for syntactic convenience, much as you
can in C/C++, but nevertheless both functions still exist and are
explicitly expressed.

In Python, you almost always only need the definition.

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


[issue40554] Add escape to the glossary?

2020-09-28 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

s/rely/read/

--

___
Python tracker 

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



[issue41873] Add vectorcall for float()

2020-09-28 Thread Dong-hee Na


Dong-hee Na  added the comment:

Now float() is faster!
Thank you for your contribution, Dennis :)
And thank you Victor as co-reviewer!

--
nosy: +vstinner
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



[issue41873] Add vectorcall for float()

2020-09-28 Thread Dong-hee Na


Dong-hee Na  added the comment:


New changeset e8acc355d430b45f1c3ff83312e72272262a854f by Dennis Sweeney in 
branch 'master':
bpo-41873: Add vectorcall for float() (GH-22432)
https://github.com/python/cpython/commit/e8acc355d430b45f1c3ff83312e72272262a854f


--
nosy: +corona10

___
Python tracker 

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



[issue41882] CCompiler.has_function does not delete temporary files

2020-09-28 Thread Mikhail Terekhov


Change by Mikhail Terekhov :


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

___
Python tracker 

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



[issue41882] CCompiler.has_function does not delete temporary files

2020-09-28 Thread Mikhail Terekhov


New submission from Mikhail Terekhov :

CCompiler.has_function does not delete temporary files. Depending on the 
check result it leaves temporary C source, object and executable files.

--
components: Distutils
messages: 377646
nosy: dstufft, eric.araujo, termim
priority: normal
severity: normal
status: open
title: CCompiler.has_function does not delete temporary files
type: resource usage
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



[issue41114] "TypeError: unhashable type" could often be more clear

2020-09-28 Thread Samuel Freilich


Samuel Freilich  added the comment:

> I think it's reasonable to discuss the problem on python-ideas rather than on 
> a bugs issue, when it's not obvious what the right solution is.

I did start a thread there. Don't object to that, if that's a better forum for 
this sort of thing.

--

___
Python tracker 

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



[issue41871] Add PyList_Remove() in listobject.c

2020-09-28 Thread STINNER Victor


STINNER Victor  added the comment:

I proposed to Hai Shi in his PR to add PyList_Remove() since I was surprised 
that the feature is exposed in Python but not at the C level.

> You always can use PyObject_CallMethod(). It is not a method called in tight 
> loop for which the overhead of calling method is significant.

He reimplemented the function by copying items into a new list except of the 
item which should be removed.

I expect that PyList_SetSlice() is more efficient than creating a new list, it 
modifies the list in-place.

I'm fine with rejecting this issue.

--

___
Python tracker 

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



Re: pip update fails

2020-09-28 Thread Eryk Sun
On 9/28/20, Dennis Lee Bieber  wrote:
> On Sun, 27 Sep 2020 05:33:14 +0300, "Hylton" 
> declaimed the following:
>
>> "C:\Users\user\AppData\Roaming\Python\Python38\site-packages\pip\_vendor\
>> distlib\scripts.py", line 386, in _get_launcher
>
>   That path seems to imply that you have a Python installed for single
> user...

No, it implies that the pip package was installed for just the current
user via, for example, `py -m ensurepip --user`. Per-user package
installs in 3.8 go in "%APPDATA%\Python\Python38\site-packages"
(roaming appdata). For a per-user installation of Python 3.8, pip
would be installed in
"%LOCALAPPDATA%\Programs\Python\Python38\site-packages" (local appdata
programs).
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue39603] [security][ CVE-2020-26116] http.client: HTTP Header Injection in the HTTP method

2020-09-28 Thread STINNER Victor


STINNER Victor  added the comment:

Mauro Matteo Cascella: "CVE-2020-26116 has been requested/assigned for this 
flaw via MITRE form: https://cveform.mitre.org/ I suggest mentioning it in the 
related vulnerability page: 
https://python-security.readthedocs.io/vuln/http-header-injection-method.html;

Thanks, done.

--
title: [security] http.client: HTTP Header Injection in the HTTP method -> 
[security][ CVE-2020-26116] http.client: HTTP Header Injection in the HTTP 
method

___
Python tracker 

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



[issue41842] Add codecs.unregister() to unregister a codec search function

2020-09-28 Thread STINNER Victor


Change by STINNER Victor :


--
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



[issue41842] Add codecs.unregister() to unregister a codec search function

2020-09-28 Thread STINNER Victor


STINNER Victor  added the comment:

The function is added, I close the issue. Thanks Hai Shi.

--

___
Python tracker 

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



[issue41842] Add codecs.unregister() to unregister a codec search function

2020-09-28 Thread STINNER Victor


STINNER Victor  added the comment:

codecs.unregister() is needed to write unit tests: see PR 19069 of bpo-39337.

I don't see a strong need to add a new codecs.unregister_error() function, 
excpet for completeness. I don't think that completeness is enough to justify 
to add the function, but feel free to open a new issue if you consider that 
it's really needed.

--

___
Python tracker 

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



[issue41881] New Line escape issue in raw strings

2020-09-28 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

It is expected behavior. \n in a raw string means two characters, backslash and 
"n", not a single newline character. Use non-raw string to embed a newline 
character.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue41842] Add codecs.unregister() to unregister a codec search function

2020-09-28 Thread STINNER Victor


STINNER Victor  added the comment:

PR 22360 required 15 iterations (15 commits) and it changes a lot of code. I 
wouldn't say that it's an "easy (C)" issue.

--

___
Python tracker 

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



[issue41861] Convert sqlite3 to PEP 384

2020-09-28 Thread Erlend Egeberg Aasland


Change by Erlend Egeberg Aasland :


--
pull_requests: +21474
pull_request: https://github.com/python/cpython/pull/22444

___
Python tracker 

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



Re: Can't install Python

2020-09-28 Thread Eryk Sun
On 9/28/20, Dennis Lee Bieber  wrote:
>
>   Python is not a GUI. You do not "click on the phyton.exe file" (sic).
> You open a command shell and, in a proper install which sets up the PATH
> environment variable, enter "python" as the command to execute.

You can run python.exe directly from Explorer -- typically from the
start menu or the Win+R run dialog. The only issue is that by default
the console that python.exe creates will close when the Python shell
exits. If you need to keep the console output around, you can simply
spawn a system shell before exiting, e.g.

>>> subprocess.Popen('pwsh'); exit()
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue40554] Add escape to the glossary?

2020-09-28 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I concur with Raymond. Are there problems with understanding the term "escape" 
in some context? If yes, then we perhaps need to clarify the corresponding 
place in the documentation. But if there is a problem with understanding the 
general word "escape", I think we should not do anything.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue41875] __builtin_unreachable error in gcc 4.4.5

2020-09-28 Thread STINNER Victor


STINNER Victor  added the comment:

Lukasz: Would you mind to cherry-pick the commit 
cca896e13b230a934fdb709b7f10c5451ffc25ba in 3.9.0 final?

--
priority: normal -> release blocker

___
Python tracker 

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



[issue41875] __builtin_unreachable error in gcc 4.4.5

2020-09-28 Thread STINNER Victor


STINNER Victor  added the comment:

FYI __builtin_unreachable() is used since this change, of bpo-38249:

commit eebaa9bfc593d5a46b293c1abd929fbfbfd28199
Author: Serhiy Storchaka 
Date:   Mon Mar 9 20:49:52 2020 +0200

bpo-38249: Expand Py_UNREACHABLE() to __builtin_unreachable() in the 
release mode. (GH-16329)

Co-authored-by: Victor Stinner 

--

___
Python tracker 

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



[issue41875] __builtin_unreachable error in gcc 4.4.5

2020-09-28 Thread miss-islington


miss-islington  added the comment:


New changeset cca896e13b230a934fdb709b7f10c5451ffc25ba by Miss Islington (bot) 
in branch '3.9':
bpo-41875: Use __builtin_unreachable when possible (GH-22433)
https://github.com/python/cpython/commit/cca896e13b230a934fdb709b7f10c5451ffc25ba


--

___
Python tracker 

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



[issue40554] Add escape to the glossary?

2020-09-28 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

For the reasons mentioned by Inada, I don't think this should be added.  

The term "escape" means many different things in different contexts.  To the 
extent the term needs to be defined, it should be done in the docs for those 
contexts (i.e. regular expression escapes should be talked about in the regex 
docs).

Side note:  It is not the purpose of the glossary to define every term in 
computer science.  The more fluff we add to the glossary, the harder it becomes 
to rely the glossary and learn Python specific terms.

--
nosy: +rhettinger

___
Python tracker 

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



[issue41170] Use strnlen instead of strlen when the size i known.

2020-09-28 Thread STINNER Victor


STINNER Victor  added the comment:

"Use strnlen instead of strlen when the size i known" rationale was "This PR 
changes strlen to strnlen so no buffer overruns are made when there's no null 
terminator", but strlen() was not called whne the string was not null 
terminated.

Serhiy wrote that strnlen() can be faster and that can be slower... If the goal 
is an optimization, a benchmark should prove it (on at least one platform).
https://github.com/python/cpython/pull/21236#issuecomment-699609949

--

___
Python tracker 

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



[issue41170] Use strnlen instead of strlen when the size i known.

2020-09-28 Thread STINNER Victor


STINNER Victor  added the comment:

PR 21236 was closed by his author, can this issue be closed?

--
nosy: +vstinner

___
Python tracker 

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



[issue41861] Convert sqlite3 to PEP 384

2020-09-28 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset cb6db8b6ae47dccc1aa97830d0f05d29f31e0cbc by Erlend Egeberg 
Aasland in branch 'master':
 bpo-41861: Convert _sqlite3 PrepareProtocolType to heap type (GH-22428)
https://github.com/python/cpython/commit/cb6db8b6ae47dccc1aa97830d0f05d29f31e0cbc


--

___
Python tracker 

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



[issue41842] Add codecs.unregister() to unregister a codec search function

2020-09-28 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset d332e7b8164c3c9c885b9e631f33d9517b628b75 by Hai Shi in branch 
'master':
bpo-41842: Add codecs.unregister() function (GH-22360)
https://github.com/python/cpython/commit/d332e7b8164c3c9c885b9e631f33d9517b628b75


--

___
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-09-28 Thread Vladimir Matveev


Change by Vladimir Matveev :


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

___
Python tracker 

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



[issue39027] run_coroutine_threadsafe uses wrong TimeoutError

2020-09-28 Thread Nick Gaya


Nick Gaya  added the comment:

@msg358296:

> IMO, it seems rather counter-intuitive to have to specify 
> `concurrent.futures.TimeoutError` when using a timeout for the future 
> returned by `run_coroutine_threadsafe()`.

I think that's expected, given that the function returns a 
`concurrent.futures.Future` object. The `Future.result()` method behaves the 
same regardless of the executor.

@avsetlov:

> futures._chain_future() should convert exceptions. Seems 
> _convert_future_exc() does this work already but maybe it fails somehow. We 
> need to investigate more.

The `_convert_future_exc()` only converts `concurrent.futures` exceptions to 
`asyncio` exceptions, not the reverse. I'm not sure if this is intentional or 
not.

With the current behavior there are two types of timeout errors that can occur 
in the example snippet:

* If the coroutine itself throws an `asyncio.exceptions.TimeoutError`, this 
will be propagated as-is to the `concurrent.futures.Future` object and thrown 
by `future.result()`.

* If the coroutine does not terminate within the timeout supplied to 
`future.result()`, then the method will throw a 
`concurrent.futures.TimeoutError` without changing the state of the future or 
the associated coroutine.

It's only necessary to cancel the future in the second case, as in the first 
case it's already in a finished state. So the example should catch 
`concurrent.futures.TimeoutError` rather than `asyncio.TimeoutError`.

--
nosy: +nickgaya

___
Python tracker 

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



[issue40554] Add escape to the glossary?

2020-09-28 Thread Roundup Robot


Change by Roundup Robot :


--
keywords: +patch
nosy: +python-dev
nosy_count: 3.0 -> 4.0
pull_requests: +21472
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/22342

___
Python tracker 

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



[issue41738] MIME type for *.zip becomes application/x-zip-compressed on Windows

2020-09-28 Thread Steve Dower


Steve Dower  added the comment:

mimetype uses the system database for MIME types, which on Windows is 
application/x-zip-compressed, so this is by design.

If you have a need to specify a MIME type that does not match the system you're 
on, you'll need your own logic.

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

___
Python tracker 

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



[issue38989] pip install selects 32 bit wheels for 64 bit python if vcvarsall.bat amd64_x86 in environment

2020-09-28 Thread Steve Dower


Steve Dower  added the comment:

I'm closing this as external, as the canonical source for platform tags is now 
the packaging library.

Either pip and/or distlib should switch to using that library or the logic 
included (which I'll note is considerably more complex - but also more well 
defined and tested - than what is in distutils).

--
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



[issue41875] __builtin_unreachable error in gcc 4.4.5

2020-09-28 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 5.0 -> 6.0
pull_requests: +21471
pull_request: https://github.com/python/cpython/pull/22442

___
Python tracker 

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



[issue41875] __builtin_unreachable error in gcc 4.4.5

2020-09-28 Thread Dong-hee Na


Dong-hee Na  added the comment:


New changeset 24ba3b0df5e5f2f237d7b23b4017ba12f16320ae by Dong-hee Na in branch 
'master':
bpo-41875: Use __builtin_unreachable when possible (GH-22433)
https://github.com/python/cpython/commit/24ba3b0df5e5f2f237d7b23b4017ba12f16320ae


--

___
Python tracker 

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



[issue41877] Check against misspellings of assert etc. in mock

2020-09-28 Thread Vedran Čačić

Vedran Čačić  added the comment:

It would be a valid argument if the API _worked_. Obviously, it doesn't. Every 
few years, the same story repeats. "We've found even more missspellings of 
assert, we need to add them too. They cause real bugs in our tests." I have a 
strong feeling it will never end.

--

___
Python tracker 

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



[issue41881] New Line escape issue in raw strings

2020-09-28 Thread Kevin Ardath


New submission from Kevin Ardath :

When attempting to concatenate some strings with a new line, I observed that 
formatting braces in a raw string skipped a new line escape:

print(r'{{}}\nx'.format())

Produces:
{}\nx

Rather than:
{}
x

--
messages: 377624
nosy: ardath.kevin
priority: normal
severity: normal
status: open
title: New Line escape issue in raw strings
type: behavior
versions: Python 3.7

___
Python tracker 

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



[issue41851] tkinter: add font equal methods

2020-09-28 Thread Tal Einat


Change by Tal Einat :


--
assignee:  -> docs@python
components: +Documentation
nosy: +docs@python

___
Python tracker 

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



[issue41773] Clarify handling of infinity and nan in random.choices

2020-09-28 Thread Ram Rachum


Change by Ram Rachum :


--
keywords: +patch
pull_requests: +21470
stage: resolved -> patch review
pull_request: https://github.com/python/cpython/pull/22441

___
Python tracker 

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



[issue41880] Get Python include directories from sysconfigdata

2020-09-28 Thread Ben Wolsieffer


Change by Ben Wolsieffer :


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

___
Python tracker 

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



[issue40105] Updating zip comment doesn't truncate the zip file

2020-09-28 Thread miss-islington


miss-islington  added the comment:


New changeset 048f54dc75d51e8a1c5822ab7b2828295192aaa5 by Miss Islington (bot) 
in branch '3.9':
bpo-40105: ZipFile truncate in append mode with shorter comment (GH-19337)
https://github.com/python/cpython/commit/048f54dc75d51e8a1c5822ab7b2828295192aaa5


--

___
Python tracker 

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



[issue41880] Get Python include directories from sysconfigdata

2020-09-28 Thread Ben Wolsieffer


New submission from Ben Wolsieffer :

The distutils.sysconfig.get_python_inc() function finds headers relative to 
sys.base_prefix or sys.base_exec_prefix. This causes problems when 
cross-compiling extension modules because Python's headers are not platform 
independent.

Instead, get_python_inc() should use the INCLUDEPY and CONFINCLUDEPY variables 
from sysconfigdata to find headers. The _PYTHON_SYSCONFIGDATA_NAME environment 
variable can then be used to make build arch Python load sysconfigdata from 
host arch Python.

--
components: Cross-Build, Distutils
messages: 377622
nosy: Alex.Willmer, benwolsieffer, dstufft, eric.araujo
priority: normal
severity: normal
status: open
title: Get Python include directories from sysconfigdata
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



[issue41879] Outdated description of async iterables in documentation of async for statement

2020-09-28 Thread Nick Gaya


New submission from Nick Gaya :

The documentation for the `async for` statement incorrectly states that "An 
asynchronous iterable is able to call asynchronous code in its iter 
implementation". Actually, this behavior was deprecated in Python 3.6 and 
removed in Python 3.7.  As of Python 3.7, the `__aiter__()` method must return 
an asynchronous iterator directly.

Suggested fix: Update the `async for` statement description for Python 3.7+ to 
match the "Asynchronous Iterators" section in the data model documentation.

> An :term:`asynchronous iterator` can call asynchronous code in its *next* 
> method.

Relevant documentation:
- 
https://docs.python.org/3/reference/compound_stmts.html#the-async-for-statement
- https://docs.python.org/3/reference/datamodel.html#asynchronous-iterators

--
assignee: docs@python
components: Documentation
messages: 377621
nosy: docs@python, nickgaya
priority: normal
severity: normal
status: open
title: Outdated description of async iterables in documentation of async for 
statement
versions: Python 3.10, Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

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



[issue41877] Check against misspellings of assert etc. in mock

2020-09-28 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

Václav, I support your suggestion and suggest that you move forward to prepare 
a PR.

Vedran, this API has been set in stone for a long time, so changing is 
disruptive.  If you really think the API needs to be redesigned, consider 
bringing it up on python-ideas.  The proposal would need broad support to move 
forward.

--
nosy: +michael.foord, rhettinger

___
Python tracker 

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



[issue41773] Clarify handling of infinity and nan in random.choices

2020-09-28 Thread Ram Rachum


Ram Rachum  added the comment:

Sounds good, I'm on it.

--

___
Python tracker 

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



[issue41773] Clarify handling of infinity and nan in random.choices

2020-09-28 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I've discussed this with other developers and now agree that a test should be 
added.  While the current code's handing of Inf or NaN is correct in a 
technical sense, it is neither intuitive or useful.

Even though it will have a small time cost for the common case of two weights, 
we should add a test just after the check for the total being greater than zero:

if not _isfinite(total):
raise ValueError('Total of weights must be finite')

Also edit the docs to say:

   Weights are assumed to be non-negative and finite.

Ram, since this was your finding, do you want to make a PR for it (with a test, 
news entry, and doc edit)?

--
resolution: not a bug -> 
status: closed -> open
type: behavior -> enhancement

___
Python tracker 

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



[issue40105] Updating zip comment doesn't truncate the zip file

2020-09-28 Thread miss-islington


Change by miss-islington :


--
pull_requests: +21468
pull_request: https://github.com/python/cpython/pull/22439

___
Python tracker 

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



[issue40105] Updating zip comment doesn't truncate the zip file

2020-09-28 Thread miss-islington


miss-islington  added the comment:


New changeset e4008404fbc0002c49becc565d42e93eca11dd75 by Miss Islington (bot) 
in branch '3.8':
bpo-40105: ZipFile truncate in append mode with shorter comment (GH-19337)
https://github.com/python/cpython/commit/e4008404fbc0002c49becc565d42e93eca11dd75


--
nosy: +miss-islington

___
Python tracker 

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



[issue41878] python3 fails to use custom dict-like object as symbols in eval()

2020-09-28 Thread Robert Haschke


New submission from Robert Haschke :

The attached file implements a custom dict-like class (MyDict) as a minimal 
example of code I am using in a larger codebase. 
Before you ask, why I reimplemented a dict-like object: The real code base 
employs a hierarchical dict, referencing recursively to the parent dict, if a 
key cannot be found in the current dict.

The main code of the file defines two entries/variables for this dict:
symbols = MyDict()
symbols['abc'] = '[1, 2, 3]'
symbols['xyz'] = 'abc + abc'

and eval_text('xyz', symbols) should evaluate to the python expression as you 
would have evaluated those variables in a python interpreter.
While this works for the first given expression (above), it fails for this one:
symbols['xyz'] = '[abc[i]*abc[i] for i in [0, 1, 2]]'

raising NameError: name 'abc' is not defined.
The same code works perfectly in python 2.7. Hence, I assume this is a bug in 
python3.

--
files: buggy.py
messages: 377616
nosy: Robert Haschke
priority: normal
severity: normal
status: open
title: python3 fails to use custom dict-like object as symbols in eval()
versions: Python 3.8
Added file: https://bugs.python.org/file49476/buggy.py

___
Python tracker 

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



[issue40105] Updating zip comment doesn't truncate the zip file

2020-09-28 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 5.0 -> 6.0
pull_requests: +21466
pull_request: https://github.com/python/cpython/pull/22436

___
Python tracker 

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



[issue40105] Updating zip comment doesn't truncate the zip file

2020-09-28 Thread Tal Einat


Tal Einat  added the comment:

Thanks for the report and initial PR, Yudi!

Thanks for the second PR, Jan!

--
nosy:  -miss-islington
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



[issue40105] Updating zip comment doesn't truncate the zip file

2020-09-28 Thread miss-islington


Change by miss-islington :


--
pull_requests: +21467
pull_request: https://github.com/python/cpython/pull/22437

___
Python tracker 

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



[issue40105] Updating zip comment doesn't truncate the zip file

2020-09-28 Thread Tal Einat


Change by Tal Einat :


--
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



[issue40105] Updating zip comment doesn't truncate the zip file

2020-09-28 Thread Tal Einat


Tal Einat  added the comment:


New changeset ff9147d93b868f0e13b9fe14e2a76c2879f6787b by Jan Mazur in branch 
'master':
bpo-40105: ZipFile truncate in append mode with shorter comment (GH-19337)
https://github.com/python/cpython/commit/ff9147d93b868f0e13b9fe14e2a76c2879f6787b


--
nosy: +taleinat

___
Python tracker 

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



[issue41870] Use PEP 590 vectorcall to speed up calls to bool()

2020-09-28 Thread STINNER Victor


STINNER Victor  added the comment:

You can put ok<0 test in the if (nargs) branch, to avoid the test when nargs=0.

--

___
Python tracker 

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



[issue41877] Check against misspellings of assert etc. in mock

2020-09-28 Thread Vedran Čačić

Vedran Čačić  added the comment:

How about we actually _solve_ the problem, instead of masking it with layer 
upon layer of obfuscation?

Python has standalone functions. assert_called (and company) should just be 
functions, they shouldn't be methods, and the problem is solved elegantly. The 
whole reason the problem exists in the first place is that Java, where Python 
copied the API from, has no standalone functions. In Pythonic design, the 
problem shouldn't exist at all.

--
nosy: +veky

___
Python tracker 

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



[issue41877] Check against misspellings of assert etc. in mock

2020-09-28 Thread Václav Brožek

New submission from Václav Brožek :

Recently we cleaned up the following typos in mocks in unittests of our 
codebase:

* Wrong prefixes of mock asserts: asert/aseert/assrt -> assert
* Wrong attribute names around asserts: autospect/auto_spec -> autospec, 
set_spec -> spec_set

Especially the asserts are dangerous, because a misspelled assert_called will 
fail silently. We found real bugs in production code which were masked by a 
misspelled assert_called.

There is prior work done to report similar cases of assert misspellings with an 
AttributeError: 
https://github.com/testing-cabal/mock/commit/7c530f0d9aa48d2538501761098df7a5a8979a7d,
 and adding new cases will be an easy change. I suppose that adding similar 
error signalling for the wrong argument names will not be much harder.

I'm prepared to implement it, if people of this project would be happy to have 
such checks.

--
components: Library (Lib)
messages: 377611
nosy: vabr2
priority: normal
severity: normal
status: open
title: Check against misspellings of assert etc. in mock
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



[issue37294] concurrent.futures.ProcessPoolExecutor state=finished raised error

2020-09-28 Thread DanilZ


DanilZ  added the comment:

After executing a single task inside a process the result is returned with 
state=finished raised error.

Error happens when trying to load a big dataset (over 5 GB). Otherwise the same 
dataset reduced to a smaller nrows executes and returns from result() without 
errors.

with concurrent.futures.ProcessPoolExecutor(max_workers = 1) as executor:
results = executor.submit(pd.read_csv, path)

data = results.result()

--
components: +2to3 (2.x to 3.x conversion tool) -Library (Lib)
nosy: +DanilZ
title: concurrent.futures.ProcessPoolExecutor and multiprocessing.pool.Pool 
fail with super -> concurrent.futures.ProcessPoolExecutor state=finished raised 
error

___
Python tracker 

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



Re: Use of a variable in parent loop

2020-09-28 Thread Grant Edwards
On 2020-09-27, Stephane Tougard via Python-list  wrote:

> However, I discovered that Emacs interprets as well an empty line or a
> comment as a breaking point of a block, it's not as good as the use of
> pass because I still have to indent up manually, but at least the
> indent-region does not break it.

I don't understand what you expect emacs 'indent-region' to do.

With token-delimited languages, it will re-do the indentation of a
block with respect to the first selected line.  That's possible
because for C et al. indentation can be deduced from keywords and
block delimiters.

That's simply not possible with Python because indentation _is_ the
delimiters.  Expecting Python to know how your code is supposed to be
indented would be like entering a block of C code with no curly braces
and then expecting emacs to know where to insert them so that the code
does what you want.

You can increase/decrease indentation by selecting a block and hitting
C-c < or C-c >.

--
Grant



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


Re: Use of a variable in parent loop

2020-09-28 Thread Grant Edwards
On 2020-09-27, Terry Reedy  wrote:
> On 9/26/2020 3:36 PM, Stephane Tougard via Python-list wrote:
>> On 2020-09-26, Terry Reedy  wrote:
>>> Noise.  Only 'pass' when there is no other code.
>> 
>> Why ?
>> 
>> I use pass and continue each time to break a if or a for because emacs
>> understands it and do not break the indentation.

Huh?  What is emacs doing to "break the indentation"?

>> Is there any other instruction to end a if than pass and ensure Emacs
>> does not break the indentation during a copy paste or an indent-region ?
>
> Emacs should come with python.el or python-mode.el defining a 
> python-mode.  Are you using it?  I presume it understands python block 
> structure without extra passes.

It works for me.

> emacs with python-mode has been and likely still is used by some 
> experienced python programmers.

I've been usnig emacs in python-mode for almost 20 years.  I've never
had any problems with.

--
Grant

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


[issue41114] "TypeError: unhashable type" could often be more clear

2020-09-28 Thread Irit Katriel


Irit Katriel  added the comment:

I think it's reasonable to discuss the problem on python-ideas rather than on a 
bugs issue, when it's not obvious what the right solution is.

--

___
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-09-28 Thread Vladimir Matveev


Vladimir Matveev  added the comment:

No, I don't think so but I can definitely make one. A few questions first:
- having PySendResult as a result type of PyIterSend seems ok, however prefix 
for each concrete value (PYGEN_*) is not aligned with the prefix of the 
function itself (PyIter_)
- should it also deal with tstate->c_tracefunc (probably not) or just be 
something like
```
PySendResult
PyIter_Send(PyObject *iter, PyObject *arg, PyObject **result)
{
_Py_IDENTIFIER(send);
assert(result != NULL);

if (PyGen_CheckExact(iter) || PyCoro_CheckExact(iter)) {
return PyGen_Send((PyGenObject *)iter, arg, result);
}

if (arg == Py_None && Py_TYPE(iter)->tp_iternext != NULL) {
*result = Py_TYPE(iter)->tp_iternext(iter);
}
else {
*result = _PyObject_CallMethodIdOneArg(iter, _send, arg);
}

if (*result == NULL) {
if (_PyGen_FetchStopIterationValue(result) == 0) {
return PYGEN_RETURN;
}
return PYGEN_ERROR;
}
return PYGEN_NEXT;
}
```

--

___
Python tracker 

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



[issue14527] How to link with a non-system libffi?

2020-09-28 Thread pmp-p


Change by pmp-p :


--
nosy: +pmpp

___
Python tracker 

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



[issue41851] tkinter: add font equal methods

2020-09-28 Thread E. Paine


Change by E. Paine :


--
pull_requests: +21465
pull_request: https://github.com/python/cpython/pull/22434

___
Python tracker 

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



[issue39603] [security] http.client: HTTP Header Injection in the HTTP method

2020-09-28 Thread Larry Hastings


Larry Hastings  added the comment:

> Also note that httplib (python-2.7.18) seems to be affected too. Any 
> particular reason for it not to be listed in the same vulnerability page?

Yes: 2.7 has been end-of-lifed and is no longer supported.

--

___
Python tracker 

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



[issue41870] Use PEP 590 vectorcall to speed up calls to bool()

2020-09-28 Thread Dong-hee Na


Dong-hee Na  added the comment:

Now I close this issue.
Thank you, Mark!

--
nosy: +Mark.Shannon

___
Python tracker 

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



[issue41870] Use PEP 590 vectorcall to speed up calls to bool()

2020-09-28 Thread Dong-hee Na


Dong-hee Na  added the comment:


New changeset a195bceff7b552c5f86dec7894ff24dcc87235da by Dong-hee Na in branch 
'master':
bpo-41870: Use PEP 590 vectorcall to speed up bool()  (GH-22427)
https://github.com/python/cpython/commit/a195bceff7b552c5f86dec7894ff24dcc87235da


--

___
Python tracker 

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



[issue41875] __builtin_unreachable error in gcc 4.4.5

2020-09-28 Thread Dong-hee Na


Dong-hee Na  added the comment:

I am able to reproduce this issue on my gcc 4.4.7

root@ef9b356a9deb:/home/cpython# gcc --version
gcc (Ubuntu/Linaro 4.4.7-8ubuntu7) 4.4.7
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE

Objects/abstract.c: In function '_PySequence_IterSearch':
Objects/abstract.c:2065: error: implicit declaration of function 
'__builtin_unreachable'
Makefile:1751: recipe for target 'Objects/abstract.o' failed
make: *** [Objects/abstract.o] Error 1

And with PR 22433, I am success to build and run test.


I 'd like to send backport patch into 3.9 also

--
nosy: +lukasz.langa

___
Python tracker 

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



[issue41876] Add __repr__ for Tkinter Font objects

2020-09-28 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :

Currently Font objects have default repr:



Since Font is just an object oriented wrapper for font name, and Font objects 
with the same name are equal, it is worth to show the font name in the repr and 
do not show an id.



--
components: Tkinter
keywords: easy
messages: 377603
nosy: serhiy.storchaka
priority: normal
severity: normal
stage: needs patch
status: open
title: Add __repr__ for Tkinter Font objects
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



[issue41851] tkinter: add font equal methods

2020-09-28 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I concur with Tal that negating size would be useless feature, and that we do 
not need an alternate equal() method. When we want to test that two strings are 
equal ignoring case we do not call a special method equalignorecase(), we just 
test that s1.casefold() == s2.casefold().

But I disagree that Font.__eq__() should be changed. The Font object is just a 
reference to the Tk font as the Path object is a reference to a file on 
filesystem. When we compare two Path objects we do not compare file sizes, 
modification times, permission bits and content. We just compare two full 
names. If two Path objects has the same full name, they are equal. If they full 
names are different, they are different, even if the corresponding files has 
the same content. The same is with Font objects.

--

___
Python tracker 

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



[issue41859] Uncaught ValueError

2020-09-28 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Reports with a reproducer are also helpful.

Again, can you get a completion box at all?

--

___
Python tracker 

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



[issue41842] Add codecs.unregister() to unregister a codec search function

2020-09-28 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Although unregistering an error handler may be not so easy, so it is better to 
open a separate issue for it.

--
keywords: +easy (C) -patch

___
Python tracker 

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



[issue14527] How to link with a non-system libffi?

2020-09-28 Thread pmp-p


Change by pmp-p :


--
nosy:  -pmpp

___
Python tracker 

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



Re: check dependencies of a pypi package

2020-09-28 Thread Arjun_tech
just go to command prompt and type pip install pandas. it will install the
latest version with all the dependencies.

On Sun, 27 Sep 2020 at 09:30, kamaraju kusumanchi <
raju.mailingli...@gmail.com> wrote:

> How can I check the dependencies of a pypi package without installing it?
>
> For example, looking at the pandas 1.1.2 package in
> https://pypi.org/project/pandas/1.1.2/, is there a way to determine
> the numpy version it depends upon without installing the package?
>
> thanks
> raju
> --
> Kamaraju S Kusumanchi | http://raju.shoutwiki.com/wiki/Blog
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Use of a variable in parent loop

2020-09-28 Thread Stephane Tougard via Python-list
On 2020-09-27, Joe Pfeiffer  wrote:
> and so forth.  What I discovered in fairly short order was that it made
> it easier for me to read my own code, but did absolutely nothing for
> either me reading other people's code, nor for them reading mine.  I
> eventually concluded my best move was to just suck it up and learn to
> program in the language as intended.

Not that I disagree, but coming from twenty years of Perl, it means
where nobody really understands the code of anybody else, that never has
really been a concern to me.

However, I discovered that Emacs interprets as well an empty line or a
comment as a breaking point of a block, it's not as good as the use of
pass because I still have to indent up manually, but at least the
indent-region does not break it.

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


Re: Use of a variable in parent loop

2020-09-28 Thread Stephane Tougard via Python-list
On 2020-09-27, MRAB  wrote:
>> If a extremist Pythonist takes over my code some day, he'll have to
>> search and delete hundreds of useless pass. I laugh already thinking
>> about it.
> He could write some code to do it.

I would do it in Perl, LOL.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Use of a variable in parent loop

2020-09-28 Thread Stephane Tougard via Python-list
On 2020-09-27, Manfred Lotz  wrote:
> - http://localhost:2015/tutorial/controlflow.html#pass-statements
...
> (In comparison to guys like ChrisA and StefanR and others here I am also
> a Python beginner)

To give me a pointer on your localhost, I could guess.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Use of a variable in parent loop

2020-09-28 Thread Stephane Tougard via Python-list
On 2020-09-27, Grant Edwards  wrote:
> Maybe you need to choose different editors and tools.

In my world, humans don't adapt to tools but human adapt tools to their
needs.

> A guy I worked for many years ago used to write BASIC programs in C by
> using a bizarre set of pre-processor macros.  While it provided his
> employees with plenty of amusement, he could never get the programs to
> work right...

It's normal, he was an ass. When I manage a team, I don't enforce tools
or language, I ask them to work the best way they can to get the things
done. If they want to write C in Perl (as I often do), I'm happy. If
they prefer Ruby (that I never learnt), or Lisp ... as long as it works
and they are able to maintain it, I'm happy as well.

Nothing is more enjoyable than a platform running a variety of languages
and technologies, working all together.

And FYI, I've done this way since 25 years and I count a few good
success in my career. Practically, my way of doing things works is at least
as well as any.

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


[issue41875] __builtin_unreachable error in gcc 4.4.5

2020-09-28 Thread Dong-hee Na


Change by Dong-hee Na :


--
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



[issue41875] __builtin_unreachable error in gcc 4.4.5

2020-09-28 Thread Dong-hee Na


Change by Dong-hee Na :


--
nosy: +serhiy.storchaka, vstinner

___
Python tracker 

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



[issue41875] __builtin_unreachable error in gcc 4.4.5

2020-09-28 Thread Dong-hee Na


Change by Dong-hee Na :


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

___
Python tracker 

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



[issue41114] "TypeError: unhashable type" could often be more clear

2020-09-28 Thread Samuel Freilich


Samuel Freilich  added the comment:

> No minor tweak to the exception message will make this go away.  For 
> understanding to occur, the only way to forward is to learn a bit about 
> hashability.  That is a step that every beginner must take.

This is a derisive and beginner-hostile response that ignores half of what's 
been said by other participants in this thread.

> Also the error message itself is easily Googled

Yeah, the first thing that comes up is ~4k Stack Overflow entries where people 
are really confused by the error message.

--

___
Python tracker 

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



[issue41875] __builtin_unreachable error in gcc 4.4.5

2020-09-28 Thread Dong-hee Na


Change by Dong-hee Na :


--
nosy: +corona10

___
Python tracker 

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



Re: Use of a variable in parent loop

2020-09-28 Thread Manfred Lotz
On Mon, 28 Sep 2020 13:39:08 +0800
Stephane Tougard  wrote:

> On 2020-09-28, Manfred Lotz  wrote:
> > On Mon, 28 Sep 2020 05:20:20 +0800
> > Stephane Tougard  wrote:
> >  
> >> On 2020-09-27, Manfred Lotz  wrote:  
> >> > -
> >> > http://localhost:2015/tutorial/controlflow.html#pass-statements
> >> >   
> >> ...  
> >> > (In comparison to guys like ChrisA and StefanR and others here I
> >> > am also a Python beginner)
> >> 
> >> To give me a pointer on your localhost, I could guess.  
> >
> > Don't understand this sentence.  
> 
> The URL you gave is pointing to your localhost, your own computer if
> you prefer.

It is amazing that I just didn't see it. I am a bad at spotting things.
Sigh.

Anyway:
https://docs.python.org/3/tutorial/controlflow.html#pass-statements


-- 
Manfred

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


[issue41838] Value error is showing in docset python (class)

2020-09-28 Thread Eric V. Smith

Eric V. Smith  added the comment:

If you can provide the information requested, please reopen this issue. In the 
meantime, I’m closing it.

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

___
Python tracker 

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



[issue41842] Add codecs.unregister() to unregister a codec search function

2020-09-28 Thread hai shi


hai shi  added the comment:

oh, sorry, typo error. multiple search functions-->multiple error handler.

--

___
Python tracker 

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



[issue41842] Add codecs.unregister() to unregister a codec search function

2020-09-28 Thread hai shi


hai shi  added the comment:

> If add a function for unregistering a codec search function, it would be 
> worth to add also a function for unregistering an error handler.

Registering an error handler have no refleaks when registering multiple search 
functions.
+1 if end user need this function.

--

___
Python tracker 

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



[issue39027] run_coroutine_threadsafe uses wrong TimeoutError

2020-09-28 Thread pfctdayelise


pfctdayelise  added the comment:

Can we at least update the docs in the meantime? It's not great having 
incorrect docs. Then if a fix is made to revert the behaviour, it can include 
updating the docs back.

--
nosy: +pfctdayelise

___
Python tracker 

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



[issue41875] __builtin_unreachable error in gcc 4.4.5

2020-09-28 Thread yota moteuchi

New submission from yota moteuchi :

While compiling a very recent release of Python (ie. 3.9.0rc2) with a fairly 
old release of gcc (ie. debian 6.0.6 gcc 4.4.5) I get the following error :

gcc -pthread -c -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall 
   -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter 
-Wno-missing-field-initializers -Werror=implicit-function-declaration 
-fvisibility=hidden  -I./Include/internal  -I. -I./Include-DPy_BUILD_CORE 
-o Parser/pegen/pegen.o Parser/pegen/pegen.c

Parser/pegen/pegen.c: In function ‘_PyPegen_seq_count_dots’:
Parser/pegen/pegen.c:1414: error: implicit declaration of function 
‘__builtin_unreachable’

Indeed, this '__builtin_unreachable()' function will exists starting from gcc 
4.5.

The configure file could detect this and offer an alternative.

(does a table of the supported gcc release for each python versions exists ?)

--
components: Build
messages: 377594
nosy: yota moteuchi
priority: normal
severity: normal
status: open
title: __builtin_unreachable error in gcc 4.4.5
type: compile error
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



  1   2   >