[issue45756] mock raises exception when using a spec with an attribute that raises exception on access

2021-12-03 Thread Nikita Sobolev


Change by Nikita Sobolev :


--
keywords: +patch
nosy: +sobolevn
nosy_count: 3.0 -> 4.0
pull_requests: +28125
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/29901

___
Python tracker 

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



[issue41768] unittest.mock spec calls class properties

2021-12-03 Thread Nikita Sobolev


Nikita Sobolev  added the comment:

Related PR: https://github.com/python/cpython/pull/29901

--
nosy: +sobolevn

___
Python tracker 

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



[issue41768] unittest.mock spec calls class properties

2021-12-03 Thread Alex Waygood


Change by Alex Waygood :


--
nosy: +lukasz.langa

___
Python tracker 

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



[issue45972] typing.NamedTuple with default arguments without type annotations is falsy

2021-12-03 Thread Erik Montnemery


New submission from Erik Montnemery :

typing.NamedTuple behaves in surprising ways when it has default arguments 
which lack type annotations:

>>> from typing import NamedTuple
>>> class MyTuple(NamedTuple):
... a = 1000
...
>>> tmp = MyTuple()
>>> tmp.a
1000
>>> len(tmp)
0
>>> bool(tmp)
False

Tested in Python 3.8 and 3.9

--
messages: 407570
nosy: emontnemery
priority: normal
severity: normal
status: open
title: typing.NamedTuple with default arguments without type annotations is 
falsy
type: behavior
versions: Python 3.8, Python 3.9

___
Python tracker 

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



[issue45756] mock raises exception when using a spec with an attribute that raises exception on access

2021-12-03 Thread Alex Waygood


Change by Alex Waygood :


--
nosy: +lukasz.langa

___
Python tracker 

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



[issue45582] Rewrite getpath.c in Python

2021-12-03 Thread Christian Heimes


Change by Christian Heimes :


--
nosy: +christian.heimes
nosy_count: 5.0 -> 6.0
pull_requests: +28126
pull_request: https://github.com/python/cpython/pull/29902

___
Python tracker 

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



[issue45972] typing.NamedTuple with default arguments without type annotations is falsy

2021-12-03 Thread Alex Waygood


Change by Alex Waygood :


--
components: +Library (Lib)
nosy: +AlexWaygood, gvanrossum, kj

___
Python tracker 

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



[issue45972] typing.NamedTuple with default arguments without type annotations is falsy

2021-12-03 Thread Spencer Brown


Spencer Brown  added the comment:

What's happening is that typing.NamedTuple ignores non-annotated attributes 
entirely when computing the names it passes along to namedtuple(), so here "a" 
is just a class attribute. You're accessing it from there, but the tuple itself 
is entirely empty. Perhaps it should error out if no names at all are found?

--
nosy: +Spencer Brown

___
Python tracker 

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



[issue45972] typing.NamedTuple with default arguments without type annotations is falsy

2021-12-03 Thread Eric V. Smith


Eric V. Smith  added the comment:

I don't think we'd want to prohibit zero-length namedtuples (or NamedTuples). 
I've used them, especially when I'm dynamically creating them.

This is just a side effect of how Python works. I don't think there's anything 
to do here, except maybe mention it in the docs, and I'm not even sure that's a 
good idea.

--
nosy: +eric.smith

___
Python tracker 

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



[issue45972] typing.NamedTuple with default arguments without type annotations is falsy

2021-12-03 Thread Alex Waygood


Alex Waygood  added the comment:

I agree that prohibiting zero-length NamedTuples seems like a bad idea, and 
also agree that this probably doesn't need to be documented.

The behaviour here definitely looks weird at first glance, but it's probably 
not a good idea to tamper with the __bool__() methods of NamedTuple classes 
either: an empty NamedTuple probably *should* be falsey by default, even if it 
has a class attribute.

--

___
Python tracker 

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



[issue45967] Tkinter.ttk.Treeview does not clear after opening and reopening another using same code block

2021-12-03 Thread E. Paine


E. Paine  added the comment:

This is because your code isn't clearing the Treeview, it's hiding it by 
setting the parent Frame's width and height to 0. When this parent Frame is 
reshown, because you want to put a new TreeView on it, the old one is still 
there.

The easiest way to solve this is to probably create `xtree` just below where 
you set-up the menu instead of in the function (since you're already calling 
`xtree.delete`, problem is it's currently being called on the empty tree you've 
just created).

In the future, for issues such as this, please try posting on Stack Overflow 
first before then raising it with us. Additionally, please post a minimal 
reproducible example, rather than your full code since it makes it much harder 
for us to get to the bottom of the problem. One final thing: you may wish to 
change your MariaDB password for security, since this was included in the file 
you uploaded.

--
nosy: +epaine

___
Python tracker 

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



[issue45972] typing.NamedTuple with default arguments without type annotations is falsy

2021-12-03 Thread Erik Montnemery


Erik Montnemery  added the comment:

I think elaborating in the documentation that only annotated attributes make it 
to the underlying namedtuple() would be helpful, it's not obvious that they are 
instead just class attributes.

--

___
Python tracker 

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



[issue45972] typing.NamedTuple with default arguments without type annotations is falsy

2021-12-03 Thread Alex Waygood


Alex Waygood  added the comment:

To me, the fact that NamedTuple uses class attributes to provide field defaults 
feels like an implementation detail that is only relevant to an unusual edge 
case.

Where do you think the documentation should be improved, and what is your 
suggested wording? :)

--

___
Python tracker 

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



[issue45654] Freeze the runpy module.

2021-12-03 Thread Kumar Aditya


Change by Kumar Aditya :


--
keywords: +patch
nosy: +kumaraditya303
nosy_count: 2.0 -> 3.0
pull_requests: +28127
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/29903

___
Python tracker 

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



[issue45885] Specialize COMPARE_OP

2021-12-03 Thread Mark Shannon


Mark Shannon  added the comment:


New changeset 03768c4d139df46212a091ed931aad03bec18b57 by Dennis Sweeney in 
branch 'main':
bpo-45885: Specialize COMPARE_OP (GH-29734)
https://github.com/python/cpython/commit/03768c4d139df46212a091ed931aad03bec18b57


--

___
Python tracker 

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



[issue20750] Roundtrip-test tokenize.untokenize(iterable_of_5_tuples)

2021-12-03 Thread Irit Katriel


Irit Katriel  added the comment:

The 7 tests are still removed and need to be checked:

https://github.com/python/cpython/blob/03768c4d139df46212a091ed931aad03bec18b57/Lib/test/test_tokenize.py#L1620

--
nosy: +iritkatriel
versions: +Python 3.11 -Python 3.3, Python 3.4

___
Python tracker 

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



[issue45972] typing.NamedTuple with default arguments without type annotations is falsy

2021-12-03 Thread Erik Montnemery


Erik Montnemery  added the comment:

Maybe something like this:

diff --git a/Doc/library/typing.rst b/Doc/library/typing.rst
index 735d477db4..8de913d8db 100644
--- a/Doc/library/typing.rst
+++ b/Doc/library/typing.rst
@@ -1291,7 +1291,8 @@ These are not used in annotations. They are building 
blocks for declaring types.

 .. class:: NamedTuple

-   Typed version of :func:`collections.namedtuple`.
+   Typed version of :func:`collections.namedtuple`, annotated fields are passed
+   to an underlying `collections.namedtuple`.

Usage::

@@ -1311,9 +1312,20 @@ These are not used in annotations. They are building 
blocks for declaring types.

   employee = Employee('Guido')
   assert employee.id == 3
+  assert employee == ('Guido', 3)

Fields with a default value must come after any fields without a default.

+   Non-annotated fields will not be part of the `collections.namedtuple`::
+
+  class Employee(NamedTuple):
+  name = 'Guido'
+  id = 3
+
+  employee = Employee()
+  assert employee.id == 3
+  assert not employee  # Passes because the collections.namedtuple is empty
+
The resulting class has an extra attribute ``__annotations__`` giving a
dict that maps the field names to the field types.  (The field names are in

--

___
Python tracker 

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



[issue7727] xmlrpc library returns string which contain null ( \x00 )

2021-12-03 Thread Irit Katriel

Irit Katriel  added the comment:

2.7 is no longer relevant, and it looks like these examples are working now:

>>> xmlrpc.client.dumps(('\u20ac',), encoding='iso-8859-1')
'\n\n€\n\n\n'
>>> xmlrpc.client.dumps((u'\u20ac',), encoding='iso-8859-1')
'\n\n€\n\n\n'

There is possibly still a documentation enhancement to make regarding non-ascii 
strings. This is what I get now with Serhiy's examples:

>>> xmlrpc.client.loads(xmlrpc.client.dumps(('\xe2\x82\xac',)))
(('â\x82¬',), None)
>>> xmlrpc.client.loads(xmlrpc.client.dumps(('\r',)))
(('\n',), None)
>>> xmlrpc.client.loads(xmlrpc.client.dumps(('\r\n',)))
(('\n',), None)

--
nosy: +iritkatriel

___
Python tracker 

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



[issue23538] New Windows installer in 3.5.0a1 breaks compatibility with Wine

2021-12-03 Thread Irit Katriel


Irit Katriel  added the comment:

There doesn't seem to be information here that can help do anything about it, 
and version 3.5 is no longer maintained.

Please create a new issue if you are still having this problem with current 
versions (>= 3.9).

--
nosy: +iritkatriel
resolution:  -> out of date
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



[issue27946] elementtree calls PyDict_GetItem without owning a reference to the dict

2021-12-03 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Concur with Irit. We should patch the caller of PyDict_GetItem, not 
PyDict_GetItem.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue20970] [doc] contradictory documentation for prog option of argparse

2021-12-03 Thread Irit Katriel


Change by Irit Katriel :


--
keywords: +easy -patch
title: contradictory documentation for prog option of argparse -> [doc] 
contradictory documentation for prog option of argparse
type:  -> behavior
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 2.7, Python 3.4, Python 
3.5

___
Python tracker 

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



[issue30214] make_zip.py lacks command a few line options.

2021-12-03 Thread Irit Katriel


Irit Katriel  added the comment:

Tools/msi/make_zip.py does not exist since 3.7.

--
nosy: +iritkatriel
resolution:  -> out of date
stage:  -> resolved
status: open -> closed
type:  -> enhancement

___
Python tracker 

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



[issue45957] _tkinter.TclError: expected boolean value but got ""

2021-12-03 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

It looks like a bug in Tk 8.6.11. It is expected that the implementation of "wm 
overrideredirect" returns an empty string if pass the boolean argument. The 
returned value is an empty string, but its type is not cleared. Seems it keeps 
the type of previous result.

I think that we can add a workaround for this bug, although it may be 
inconvenient to test it. Do we still use Tk 8.6.11 on any platform with Python 
3.9+? Note that Python 3.8 only takes security fixes, so any changes can only 
be made in 3.9+.

--
nosy: +epaine, terry.reedy

___
Python tracker 

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



[issue45957] _tkinter.TclError: expected boolean value but got ""

2021-12-03 Thread Alex Waygood


Change by Alex Waygood :


--
type: crash -> behavior

___
Python tracker 

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



[issue45695] Out-of-tree builds are not tested.

2021-12-03 Thread Christian Heimes


Change by Christian Heimes :


--
keywords: +patch
pull_requests: +28128
stage: test needed -> patch review
pull_request: https://github.com/python/cpython/pull/29904

___
Python tracker 

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



[issue45957] _tkinter.TclError: expected boolean value but got ""

2021-12-03 Thread E. Paine


E. Paine  added the comment:

> Do we still use Tk 8.6.11 on any platform with Python 3.9+

No, none of the python.org installers include it now. On Linux, according to 
https://pkgs.org/download/tk, several distros still use 8.6.11 (most notably 
Ubuntu 21.04). I'll see if I can reproduce it on Linux using 8.6.11 and then we 
can decide whether or not a workaround is required.

--

___
Python tracker 

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



[issue45971] calendar module issue

2021-12-03 Thread Christian Heimes


Christian Heimes  added the comment:

> Note: Sep. 1752 had only 19 days. ( 11 days skipped )

That statement is only correct for countries where the Church of England was 
predominant: Great Britain and colonies of the British Empire in e.g, North 
America (later known as US of A). Alaska changed later when Russia sold it to 
the US.

Catholic countries such as Italy, Spain, Portugal, and France adopted the 
Gregorian calendar 170 years earlier. For Germany it gets really complicated 
and depends on county, kingdom, and the current religion of sovereign.

--
nosy: +christian.heimes

___
Python tracker 

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



[issue45582] Rewrite getpath.c in Python

2021-12-03 Thread Christian Heimes


Christian Heimes  added the comment:


New changeset ccb73a0d50dd03bc8455fe210cb83e41a6dc91d8 by Christian Heimes in 
branch 'main':
bpo-45582: Fix out-of-tree build issues with new getpath (GH-29902)
https://github.com/python/cpython/commit/ccb73a0d50dd03bc8455fe210cb83e41a6dc91d8


--

___
Python tracker 

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



[issue45962] Clarify that PyModule_AddString{Constant, Macro} use utf-8

2021-12-03 Thread Alex Waygood


Change by Alex Waygood :


--
type:  -> enhancement

___
Python tracker 

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



[issue45964] 3.10.0 tests fail in test_pdb_breakpoints_preserved_across_interactive_sessions

2021-12-03 Thread Alex Waygood


Change by Alex Waygood :


--
type:  -> behavior

___
Python tracker 

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



[issue45964] gdb test fails when packaging Python 3.10 for openSUSE/Linux

2021-12-03 Thread Irit Katriel


Change by Irit Katriel :


--
title: 3.10.0 tests fail in 
test_pdb_breakpoints_preserved_across_interactive_sessions -> gdb test fails 
when packaging Python 3.10 for openSUSE/Linux

___
Python tracker 

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



[issue45964] 3.10.0 tests fail in test_pdb_breakpoints_preserved_across_interactive_sessions

2021-12-03 Thread Irit Katriel


Irit Katriel  added the comment:

> Happens when packaging Python 3.10 for openSUSE/Linux.

Can you give full details of what you're doing?

--

___
Python tracker 

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



[issue45635] Tidy up error handling in traceback.c / python run.c

2021-12-03 Thread Irit Katriel


Change by Irit Katriel :


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

___
Python tracker 

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



[issue20741] Documentation archives should be available also in tar.xz format

2021-12-03 Thread Irit Katriel


Irit Katriel  added the comment:

Those archives seem to go only up to 3.9. Is this still relevant?

--
nosy: +iritkatriel

___
Python tracker 

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



[issue45973] Not possible to clear PyImport_Inittab after PyImport_AppendInittab

2021-12-03 Thread Daniel


New submission from Daniel :

Hello,

When embedding Python into a C application and not using Py_RunMain it is not 
possible to remove a module added to PyImport_Inittab even if the interpreter 
is finalized and a new is created.

One reason for not using Py_RunMain is to use python as a subprocessor to my 
primary C application by initializing an interpreter, run some python code, 
then go back to execute some C code and again execute some python code in the 
same interpreter. After a while I might want to finalize the interpreter and 
create a new one without the module added to inittab, still being in the same 
process.

See example:

#include 


/*
 * Create a python interpreter, run a command and delete the interpreter
 */
void run_in_new_interpreter(char *cmd) {
Py_Initialize();

PyRun_SimpleString(cmd);

if (Py_FinalizeEx() < 0) {
exit(120);
}
}

/*
 * Create a module "my_spam" but do not append it to inittab
 */
static PyModuleDef EmbModule = {
  PyModuleDef_HEAD_INIT, "my_spam", NULL, -1,
  NULL,
  NULL, NULL, NULL, NULL
};

static PyObject* PyInit_emb(void) {
return PyModule_Create(&EmbModule);
}

/*
 * Main program
 */
char *LIST_MODULES_CMD="try:\n import my_spam; print('SPAM!');\nexcept:\n 
print('no mod my_spam')";

int main(int argc, char *argv[]) {
// Run with no "my_spam" module
run_in_new_interpreter(LIST_MODULES_CMD);

// Run with "my_spam" module
PyImport_AppendInittab("my_spam", &PyInit_emb);
run_in_new_interpreter(LIST_MODULES_CMD);

// How to run without my_spam? The module is still in the PyImport_Inittab
// despite the Py_FinalizeEx() call. This list is not reset until
// _PyImport_Fini2() is called, but that is never exposed in anyi public 
header,
// only in Include/internal/pycore_pylifecycle.h
run_in_new_interpreter(LIST_MODULES_CMD);
return 0;
}



The output of the program is:

>>> gcc test_embed.c `pkg-config --cflags --libs python-3.6` && ./a.out
no mod my_spam
SPAM!
SPAM!

--
components: C API
messages: 407590
nosy: daniel-falk
priority: normal
severity: normal
status: open
title: Not possible to clear PyImport_Inittab after PyImport_AppendInittab
type: behavior

___
Python tracker 

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



[issue45695] Out-of-tree builds are not tested.

2021-12-03 Thread Christian Heimes


Christian Heimes  added the comment:

Good news: I got a test case for OOT build with read-only sources

Bad news: 15 test cases are failing and testing takes much longer because pyc 
files are missing.

15 re-run tests:
test__xxsubinterpreters test_ast test_bdb test_capi test_doctest
test_import test_importlib test_interpreters test_pickle
test_pydoc test_runpy test_support test_threading test_trace
test_unicodedata

We have to live with read-only OOT builds and writable tests for now.

--

___
Python tracker 

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



[issue20751] Misleading descriptor protocol documentation: direct call, super binding

2021-12-03 Thread Irit Katriel


Change by Irit Katriel :


--
type:  -> behavior
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 2.7, 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



[issue45950] Reintroduce bootstrap_python for freezing

2021-12-03 Thread Christian Heimes


Christian Heimes  added the comment:


New changeset 84ca1232b0f1e4be368e89550a9ceb46f64a0eff by Christian Heimes in 
branch 'main':
bpo-45950: Introduce Bootstrap Python again (#29859)
https://github.com/python/cpython/commit/84ca1232b0f1e4be368e89550a9ceb46f64a0eff


--

___
Python tracker 

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



[issue45964] gdb test fails when packaging Python 3.10 for openSUSE/Linux

2021-12-03 Thread Christian Heimes


Christian Heimes  added the comment:

This looks like a problem on your side. Line 94 is the correct line for the 
function in 3.10.0 release.

$ git checkout v3.10.0
$ sed -n '94p' Lib/pdb.py 
def find_function(funcname, filename):

Matej, does your build system perhaps strip off the shebang of Lib/pdb.py? That 
would explain why you are getting the function on line 93.

--
nosy: +christian.heimes

___
Python tracker 

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



[issue20751] Misleading descriptor protocol documentation: direct call, super binding

2021-12-03 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
assignee: docs@python -> rhettinger

___
Python tracker 

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



[issue20751] Harmonize descriptor protocol documentation: direct call, super binding with Descriptor Howto docs

2021-12-03 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
title: Misleading descriptor protocol documentation: direct call, super binding 
-> Harmonize descriptor protocol documentation: direct call, super binding with 
Descriptor Howto docs

___
Python tracker 

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



[issue27582] Mispositioned SyntaxError caret for unknown code points

2021-12-03 Thread Irit Katriel


Change by Irit Katriel :


--
stage: needs patch -> 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



[issue45695] Out-of-tree builds are not tested.

2021-12-03 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

Nice trick with that RO bind mount.  tests... yes we do have some writable 
source tree messes in there to be dealt with.

--

___
Python tracker 

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



[issue45695] Out-of-tree builds are not tested.

2021-12-03 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

FWIW, it is also impossible to build the docs OOT without cluttering the source 
tree.

$ cd ../build
$ make -C ../cpython.git/Doc venv
$ make -C ../cpython.git/Doc html  # <= modifies Doc/build in the source 
tree

--
nosy: +erlendaasland

___
Python tracker 

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



[issue45967] Tkinter.ttk.Treeview does not clear after opening and reopening another using same code block

2021-12-03 Thread Ned Deily


Change by Ned Deily :


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

___
Python tracker 

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



[issue45967] Tkinter.ttk.Treeview does not clear after opening and reopening another using same code block

2021-12-03 Thread Harold Meneley


Harold Meneley  added the comment:

Some times , I forget the program languages differences. Sorry. Thanks for
your time. Harold

On Fri, Dec 3, 2021, 12:48 PM Ned Deily  wrote:

>
> Change by Ned Deily :
>
>
> --
> resolution:  -> not a bug
> stage:  -> resolved
> status: open -> closed
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue45711] Simplify the interpreter's (type, val, tb) exception representation

2021-12-03 Thread Irit Katriel


Irit Katriel  added the comment:


New changeset 2ff758bd1a144ee712e96ae1db91f476c3b252bb by Irit Katriel in 
branch 'main':
bpo-45711: [asyncio] Normalize exceptions immediately after Fetch, before they 
are stored as StackItem, which should be normalized (GH-29890)
https://github.com/python/cpython/commit/2ff758bd1a144ee712e96ae1db91f476c3b252bb


--

___
Python tracker 

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



[issue45960] bullseye arm/v7 time.time() Operation not permitted

2021-12-03 Thread Christian Heimes


Christian Heimes  added the comment:

time.time() is a wrapper for libc function call clock_gettime() with 
CLOCK_REALTIME. This is either a problem with the container build or a Kernel 
ABI issue between the container build and your operating system.

I suggest that you report the issue to https://github.com/docker-library/python 
. The Dockerhub Python image is not maintained by us.

--
nosy: +christian.heimes

___
Python tracker 

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



[issue45816] Python does not support standalone MSVC v143 (VS 2022) Build Tools

2021-12-03 Thread Steve Dower


Steve Dower  added the comment:


New changeset d9301703fb1086cafbd730c17e3d450a192485d6 by Crowthebird in branch 
'main':
bpo-45816: Support building with VS 2022 (v143 toolset) on Windows (GH-29577)
https://github.com/python/cpython/commit/d9301703fb1086cafbd730c17e3d450a192485d6


--

___
Python tracker 

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



[issue45816] Python does not support standalone MSVC v143 (VS 2022) Build Tools

2021-12-03 Thread Steve Dower


Change by Steve Dower :


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



[issue44530] Propagate qualname from the compiler unit to code objects for finer grained profiling data

2021-12-03 Thread Steve Dower


Change by Steve Dower :


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



[issue39529] Deprecate get_event_loop()

2021-12-03 Thread Ben Darnell


Ben Darnell  added the comment:

> In IPython, I think you could use new_event_loop() for getting a new loop 
> instance.
> Then, save the loop reference somewhere as a direct attribute, 
> threading.local or ContextVar.
> Calling loop.run_until_complete() looks pretty normal in your situation.

That works if you're a leaf in the dependency tree, but what about a library 
like Tornado (which IPython depends on)? If intermediate libraries (say Tornado 
and Twisted) introduce their own thread-local loops for backwards compatibility 
of their existing interfaces, the ecosystem gets fragmented again. Having the 
thread-local live in asyncio is useful for seamless interoperability across 
frameworks. 

> asyncio.run() is entirely self-reliant in that it creates all needed 
> resources at the start and closes them in finalization, rather than depending 
> on existing resources. I believe this to be significantly safer and better 
> guaranteed to function as intended, although perhaps at some cost to 
> convenience in cases like your own where there only needs to be one event 
> loop.

Whether or not this is more likely to function as intended depends on 
assumptions about user expectations. In Tornado (and other async systems I have 
used in the past), it is the norm to set up handlers on an event loop while it 
is not running and then start it afterwards. The behavior of asyncio.run is 
surprising to me. Maybe I'm weird, but regardless of which behavior is 
surprising to the fewest people, my point is that this change is very 
disruptive to Tornado and most applications using it, contrary to the claim 
that the maintenance burden should be pretty low.

I realize it may be too late to change course, but my preference would have 
been to resolve the conflict between get_event_loop and asyncio.run by making 
asyncio.run essentially an alias for 
asyncio.get_event_loop().run_until_complete. This would relax the isolation of 
asyncio.run, but that doesn't seem very important to me. The comparable idioms 
in Tornado (using the IOLoop.run_sync method) all work this way and I've never 
seen any confusion related to this or a situation in which creating a brand-new 
event loop in run_sync would be desirable.

--

___
Python tracker 

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



[issue45582] Rewrite getpath.c in Python

2021-12-03 Thread neonene


Change by neonene :


--
nosy: +neonene
nosy_count: 6.0 -> 7.0
pull_requests: +28130
pull_request: https://github.com/python/cpython/pull/29906

___
Python tracker 

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



[issue35419] Thread.is_alive while running Process.is_alive causes either premature termination or never-terminating.

2021-12-03 Thread Irit Katriel


Irit Katriel  added the comment:

Use this queue for multithreaded applications: 
https://docs.python.org/3/library/queue.html


Mixing multiprocessing with multithreading often doesn't work.

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



[issue45877] Inconsistency in minimal supported version of Microsoft Visual Studio

2021-12-03 Thread Steve Dower


Steve Dower  added the comment:

It probably all needs straightening out:

* Microsoft Visual Studio 2015 *or later* can be used to build the project files
* Microsoft Visual C++ 14.3 is what we use to build the official releases for 
the main branch (3.11)
* earlier branches may still be using prior compiler versions for the official 
releases

--

___
Python tracker 

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



[issue31735] Documentation incorrectly states how descriptors are invoked

2021-12-03 Thread Irit Katriel


Irit Katriel  added the comment:

See also Issue20751

--
nosy: +iritkatriel, rhettinger

___
Python tracker 

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



[issue12384] difflib.SequenceMatcher and Match: code and doc bugs

2021-12-03 Thread Irit Katriel


Change by Irit Katriel :


--
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 2.7, Python 3.2, Python 
3.3

___
Python tracker 

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



[issue45582] Rewrite getpath.c in Python

2021-12-03 Thread neonene


neonene  added the comment:

PGO-instrumented binary seems not to specify the stdlib directory on PR29041. I 
can run it with PYTHONPATH set.


Python path configuration:
  PYTHONHOME = 'C:\Py311\'
  PYTHONPATH = (not set)
  program name = 'C:\Py311\PCbuild\amd64\instrumented\python.exe'
  isolated = 0
  environment = 1
  user site = 1
  import site = 1
  is in build tree = 1
  stdlib dir = 'C:\Py311\PCbuild\Lib'
  sys._base_executable = 'C:\\py311\\PCbuild\\amd64\\instrumented\\python.exe'
  sys.base_prefix = 'C:\\py311\\'
  sys.base_exec_prefix = 'C:\\py311\\'
  sys.platlibdir = 'DLLs'
  sys.executable = 'C:\\py311\\PCbuild\\amd64\\instrumented\\python.exe'
  sys.prefix = 'C:\\py311\\'
  sys.exec_prefix = 'C:\\py311\\'
  sys.path = [
'C:\\py311\\PCbuild\\amd64\\instrumented\\python311.zip',
'C:\\py311\\PCbuild\\Lib',
'C:\\py311\\PCbuild\\amd64\\instrumented',
  ]
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'

--

___
Python tracker 

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



[issue31735] Documentation incorrectly states how descriptors are invoked

2021-12-03 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
assignee: docs@python -> rhettinger

___
Python tracker 

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



[issue31735] Documentation incorrectly states how descriptors are invoked

2021-12-03 Thread Irit Katriel


Change by Irit Katriel :


--
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 2.7, Python 3.4, Python 
3.5, 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



[issue23317] Incorrect description of descriptor invocation in Python Language Reference

2021-12-03 Thread Irit Katriel


Irit Katriel  added the comment:

See also issue20751.

--
nosy: +iritkatriel, rhettinger

___
Python tracker 

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



[issue31441] Descriptor example in documentation is confusing, possibly wrong

2021-12-03 Thread Irit Katriel


Irit Katriel  added the comment:

see also issue20751.

--
nosy: +iritkatriel

___
Python tracker 

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



[issue45607] Make it possible to enrich an exception's error message

2021-12-03 Thread Irit Katriel


Irit Katriel  added the comment:


New changeset 5bb7ef2768be5979b306e4c7552862b1746c251d by Irit Katriel in 
branch 'main':
bpo-45607: Make it possible to enrich exception displays via setting their 
__note__ field (GH-29880)
https://github.com/python/cpython/commit/5bb7ef2768be5979b306e4c7552862b1746c251d


--

___
Python tracker 

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



[issue45607] Make it possible to enrich an exception's error message

2021-12-03 Thread Irit Katriel


Change by Irit Katriel :


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

___
Python tracker 

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



[issue28953] Use `raise from` when raising new IncompleteRead

2021-12-03 Thread Irit Katriel


Irit Katriel  added the comment:

I just pushed a new feature which may provide a simpler way to do this: 
https://bugs.python.org/issue45607

--
nosy: +iritkatriel

___
Python tracker 

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



[issue45582] Rewrite getpath.c in Python

2021-12-03 Thread Steve Dower


Steve Dower  added the comment:


New changeset 7d7c91a8e8c0bb04105a21a17d1061ffc1c04d80 by neonene in branch 
'main':
bpo-45582: Add a NOT operator to the condition in getpath_isxfile (GH-29906)
https://github.com/python/cpython/commit/7d7c91a8e8c0bb04105a21a17d1061ffc1c04d80


--

___
Python tracker 

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



[issue45974] Using walrus produces different/unoptimized bytecode

2021-12-03 Thread Fatih Kilic


New submission from Fatih Kilic :

So, what I mean by unoptimized bytecode is, for example when you type `a = 10 * 
10`, the resulting bytecode is the following: 
```
LOAD_CONST 0 (100)
STORE_NAME 0 (a)
...
```

However, when you type, `(a := 10 * 10) == None`, the resulting bytecode is the 
following:
```
LOAD_CONST 0 (10)
LOAD_CONST 0 (10)
BINARY_MULTIPLY
DUP_TOP
STORE_NAME 0 (a)
...
```

I don't know if this is intentional, but shouldn't the resulting bytecode be 
the following:
```
LOAD_CONST 0 (100)
DUP_TOP
STORE_NAME 0 (a)
...
```

--
components: Parser
messages: 407610
nosy: FKLC, lys.nikolaou, pablogsal
priority: normal
severity: normal
status: open
title: Using walrus produces different/unoptimized bytecode
type: behavior
versions: Python 3.10, Python 3.11, 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



[issue45974] Using walrus produces different/unoptimized bytecode

2021-12-03 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

See: https://bugs.python.org/issue42282 
and the reason for not backporting this: 
https://bugs.python.org/issue42282#msg380506

--
components: +Interpreter Core -Parser
nosy: +BTaskaya
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
type: behavior -> performance
versions:  -Python 3.11

___
Python tracker 

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



[issue45974] Using walrus produces different/unoptimized bytecode

2021-12-03 Thread Fatih Kilic


Fatih Kilic  added the comment:

Ah, I see. Thanks!

--

___
Python tracker 

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



[issue44844] The command line of launching Edge on Linux hangs

2021-12-03 Thread Steve Dower


Change by Steve Dower :


--
pull_requests:  -27916

___
Python tracker 

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



[issue45582] Rewrite getpath.c in Python

2021-12-03 Thread Benjamin Peterson


Change by Benjamin Peterson :


--
nosy: +benjamin.peterson
nosy_count: 7.0 -> 8.0
pull_requests: +28131
pull_request: https://github.com/python/cpython/pull/29907

___
Python tracker 

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



[issue31441] Descriptor example in documentation is confusing, possibly wrong

2021-12-03 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

This example was removed and replaced with better examples.

--
resolution:  -> out of date
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



[issue44844] The command line of launching Edge on Linux hangs

2021-12-03 Thread Steve Dower


Change by Steve Dower :


--
pull_requests: +28132
pull_request: https://github.com/python/cpython/pull/29908

___
Python tracker 

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



[issue44844] The command line of launching Edge on Linux hangs

2021-12-03 Thread Steve Dower


Steve Dower  added the comment:

@Ray I posted a PR that works fine on Windows, would you be able to try it on 
Linux? The executables seem to have different names, so I'm a little concerned 
about the change, but I think it should be alright.

--

___
Python tracker 

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



[issue33909] PyObject_CallFinalizerFromDealloc is not referenced in any documentation

2021-12-03 Thread Irit Katriel


Change by Irit Katriel :


--
nosy: +pitrou
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 3.4, Python 3.5, 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



[issue45975] Simplify some while-loops with walrus operator

2021-12-03 Thread Nick Drozd


New submission from Nick Drozd :

The following pattern occurs a few times in the codebase:

  while 1:
  data = conn.recv(blocksize)
  if not data:
  break
  ...

There is an unbounded while loop in which some kind of input is read. If the 
input is there, it is processed and the loop is continued; otherwise the loop 
is broken.

This can be expressed more cleanly with the walrus operator:

  while data := conn.recv(blocksize):
 ...

Some of this code goes back to the days of Python 1. I assume that the original 
authors would have used the walrus idiom if it had been available, which it 
wasn't. But now it is.

Rewriting the instances of this pattern shaves off 148 lines from the codebase. 
Removing the manual break statements makes the logic more straightforward.

This should not change the behavior of anything. I'm assuming that this code is 
all under test and that any deviations from the existing behavior will be 
caught. Anything that isn't tested shouldn't be changed (and should be tested).

--
components: Library (Lib)
messages: 407615
nosy: nickdrozd
priority: normal
pull_requests: 28133
severity: normal
status: open
title: Simplify some while-loops with walrus operator
versions: Python 3.11

___
Python tracker 

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



[issue45582] Rewrite getpath.c in Python

2021-12-03 Thread miss-islington


miss-islington  added the comment:


New changeset 0ae4e0c959bbc90ec18180ef3cc957759d346ced by Benjamin Peterson in 
branch 'main':
bpo-45582 Fix prototype of _Py_Get_Getpath_CodeObject. (GH-29907)
https://github.com/python/cpython/commit/0ae4e0c959bbc90ec18180ef3cc957759d346ced


--
nosy: +miss-islington

___
Python tracker 

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



[issue26160] [doc] Tutorial incorrectly claims that (explicit) relative imports don't work in the main module

2021-12-03 Thread Irit Katriel


Change by Irit Katriel :


--
title: Tutorial incorrectly claims that (explicit) relative imports don't work 
in the main module -> [doc] Tutorial incorrectly claims that (explicit) 
relative imports don't work in the main module
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 2.7, Python 3.5, Python 
3.6

___
Python tracker 

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



[issue20751] Harmonize descriptor protocol documentation: direct call, super binding with Descriptor Howto docs

2021-12-03 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Regarding comment #1, The wording is correct and there was a reason for using a 
method.  While super() can be used for attribute lookup, use cases are almost 
entirely dominated by method lookups.  For many users, an attribute lookup with 
super() is unconventional, weird, hard to grok, awkward to demonstrate, and not 
well motivated by the way super() is actually used.

##
# Demonstration code for the example in text

class A:
def m(self):
return 42

class B(A):
def m(obj):
return super(B, obj).m()

>>> b = B()
>>> b.m() # Normal invocation 
42
>>> A.__dict__['m'].__get__(b, B)()   # Equivalent call
42

That said, I will switch it to an attribute lookup for consistency with the 
other examples in the section and with the current version of the 
DescriptorHowto.


Regarding comment #2, the objtype argument is optional as shown in all of the 
examples.  The call from object.__getattribute__() always passes in both 
parameters, even though only the first is required.
  

# Demonstration of __get__() being called with one or two params

class A:
def __init__(self, x):
self.x = x
def m(self, y):
return self.x * y

>>> a = A(10)
>>> a.m(5)
50
>>> vars(A)['m'].__get__(a)(5) # objtype is not required
50
>>> vars(A)['m'].__get__(a, A)(5)  # objtype may be used
50



# Demonstration of object.__getattribute__ supplying both args

class Desc:
def __get__(self, *args):
return args
  
class B:
z = Desc()
 
>>> b = B()
>>> b.z
(<__main__.B object at 0x109156110>, )

--
resolution:  -> not a bug

___
Python tracker 

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



[issue9544] [doc] xdrlib.Packer().pack_fstring throws a TypeError when called with a str()

2021-12-03 Thread Irit Katriel


Change by Irit Katriel :


--
title: xdrlib.Packer().pack_fstring throws a TypeError when called with a str() 
-> [doc] xdrlib.Packer().pack_fstring throws a TypeError when called with a 
str()
versions: +Python 3.10, Python 3.11, Python 3.9 -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



[issue24709] Unix build uses '-Wno-unused-result', which icc doesn't recognize

2021-12-03 Thread Ammar Askar


Ammar Askar  added the comment:

Looks like the latest versions of icc support this flag: 
https://www.intel.com/content/www/us/en/develop/documentation/cpp-compiler-developer-guide-and-reference/top/compiler-reference/compiler-options/compiler-option-details/compiler-diagnostic-options/wunused-variable.html

Closing as outdated.

--
nosy: +ammar2
resolution:  -> out of date
stage: needs patch -> resolved
status: open -> closed

___
Python tracker 

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



[issue45885] Specialize COMPARE_OP

2021-12-03 Thread Dennis Sweeney


Change by Dennis Sweeney :


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



[issue45975] Simplify some while-loops with walrus operator

2021-12-03 Thread Zachary Ware


Zachary Ware  added the comment:

As a general rule, refactorings like this tend to be rejected as the risk of 
inadvertently adding a new bug outweighs the benefit of subjectively cleaner 
code ("if it ain't broke, don't fix it!").

Is there any measurable performance benefit from this? Reducing several hundred 
thousand lines of code by 148 is not a compelling benefit :)

--
nosy: +zach.ware

___
Python tracker 

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



[issue20751] Harmonize descriptor protocol documentation: direct call, super binding with Descriptor Howto docs

2021-12-03 Thread Raymond Hettinger


Change by Raymond Hettinger :


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

___
Python tracker 

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



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

2021-12-03 Thread Andrei Kulakov


Change by Andrei Kulakov :


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

___
Python tracker 

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



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

2021-12-03 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

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

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

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

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

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

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

--

___
Python tracker 

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



[issue27831] Python 3.4.5 leaks memory when attempting to load non-existent file

2021-12-03 Thread Ammar Askar


Ammar Askar  added the comment:

Looks like this got fixed somewhere along between 3.5 and 3.6


---
3.5
---

./python: can't open file 'id:000109': [Errno 2] No such file or directory

=
==28078==ERROR: LeakSanitizer: detected memory leak



---
3.6
---

./python id:000109 
./python: can't open file 'id:000109': [Errno 2] No such file or directory


Closing as 3.5 is no longer a supported version.

--
nosy: +ammar2
resolution:  -> out of date
stage:  -> resolved
status: open -> closed
type:  -> behavior

___
Python tracker 

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



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

2021-12-03 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

I forgot to add this:

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

--

___
Python tracker 

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



[issue31735] Documentation incorrectly states how descriptors are invoked

2021-12-03 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> it should have
>
> d.__get__(obj, type(obj)) instead of d.__get__(obj)


The objtype argument is optional as shown in all of the examples.  The call 
from object.__getattribute__() always passes in both parameters, even though 
only the first is required.
  

# Demonstration of __get__() being called with one or two params

class A:
def __init__(self, x):
self.x = x
def m(self, y):
return self.x * y

>>> a = A(10)
>>> a.m(5)
50
>>> vars(A)['m'].__get__(a)(5) # objtype is not required
50
>>> vars(A)['m'].__get__(a, A)(5)  # objtype may be used
50



# Demonstration of object.__getattribute__ supplying both args

class Desc:
def __get__(self, *args):
return args
  
class B:
z = Desc()
 
>>> b = B()
>>> b.z
(<__main__.B object at 0x109156110>, )

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



[issue23317] Incorrect description of descriptor invocation in Python Language Reference

2021-12-03 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I think we can leave this as-is.  It does a reasonable job of communicating 
where the descriptor is found and the arguments used when it is called.

Marking this as out of date because later in the howto guide there is a precise 
pure python equivalent for the lookup and invocation steps.

--
resolution:  -> out of date
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



[issue45976] Random._randbelow() loses time by caching an attribute lookup

2021-12-03 Thread Andrew Lin


New submission from Andrew Lin :

This PR obtains a performance improvement in the random module by removing a 
cached attribute lookup in Random._randbelow_with_getrandbits() that costs time 
on average.  In the best cases (on my machine) I get 10% improvement for 
randrange(), 7% for shuffle(), and 11% for sample(), with no change in the 
worst cases.

To elaborate...  If n is slightly less than a power of 2, 
_randbelow_with_getrandbits(n) almost always makes just one call to 
getrandbits(), so caching the attribute lookup never pays for itself.  Even in 
the worst case, when n is exactly a power of 2, the expected number of calls to 
getrandbits() is still only 2, and on my machine caching just breaks even.  (A 
friend ran it on ARM and got even more favorable results.)

I included a similar change to _randbelow_without_getrandbits() on similar 
grounds, although I didn't benchmark it.

(Brand new here; let me know if I've left anything out!)

--
components: Library (Lib)
messages: 407625
nosy: onethreeseven
priority: normal
severity: normal
status: open
title: Random._randbelow() loses time by caching an attribute lookup
type: performance
versions: Python 3.11

___
Python tracker 

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



[issue45976] Random._randbelow() loses time by caching an attribute lookup

2021-12-03 Thread Roundup Robot


Change by Roundup Robot :


--
keywords: +patch
nosy: +python-dev
nosy_count: 1.0 -> 2.0
pull_requests: +28136
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/29911

___
Python tracker 

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



[issue45976] Random._randbelow() loses time by caching an attribute lookup

2021-12-03 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Thanks for the suggestion.  I'll try this out on various builds and machines to 
see how it works out.  The speed of locals is consistently fast, but the speed 
of method calls has varied over the last few versions of Python (generally 
getting faster).  When this code was first written, it was benchmarked and 
localizing was a net win.

--
assignee:  -> rhettinger
nosy: +rhettinger

___
Python tracker 

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



[issue20751] Harmonize descriptor protocol documentation: direct call, super binding with Descriptor Howto docs

2021-12-03 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset 135ecc3492cee259090fd4aaed9056c130cd2eba by Raymond Hettinger in 
branch 'main':
bpo-20751:  Replace method example with attribute example, matching the 
descriptor howto (GH-29909)
https://github.com/python/cpython/commit/135ecc3492cee259090fd4aaed9056c130cd2eba


--

___
Python tracker 

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



[issue20751] Harmonize descriptor protocol documentation: direct call, super binding with Descriptor Howto docs

2021-12-03 Thread Raymond Hettinger


Change by Raymond Hettinger :


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



[issue45976] Random._randbelow() loses time by caching an attribute lookup

2021-12-03 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

* If you post a timing script, it will make it easier for me to verify this 
across versions and across machine and for various input sizes.

* If you have time, do run some benchmarks for _randbelow_without_getrandbits()

* Try your change with and without the walrus operator.  If it doesn't make a 
difference in the timings, let's us the non-walrus version which is more 
readable.

--

___
Python tracker 

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



[issue45975] Simplify some while-loops with walrus operator

2021-12-03 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

The general rule as stated by Zachary is correct; however, I'm in mildly favor 
of this PR because these are the use cases that the walrus operator was 
specifically designed for.  That said, it would be nice to verify that timings 
don't get worse and to carefully review each edit to make sure it doesn't 
introduce a bug.

--
nosy: +rhettinger

___
Python tracker 

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



[issue45976] Random._randbelow() loses time by caching an attribute lookup

2021-12-03 Thread Andrew Lin


Andrew Lin  added the comment:

Timings are unaffected by updating to non-walrus, so I'll do so in the PR.

Using _randbelow_without_getrandbits() I get 5% improvement to sample([None] * 
2047, 50); 6% to shuffle([None] * 2000); and approximately 6% to randrange() 
for any number significantly less than 2**32.  It's not surprising that the 
absolute speedup is smaller, because _randbelow_without_getrandbits() does a 
lot more work that is untouched by the change.  On the other hand, the speedup 
is more consistent, since _randbelow_without_getrandbits(n) almost never calls 
random() more than once for any n significantly less than 2**32.

I will clean up my benchmark script and post it.

Thanks for the feedback!

--

___
Python tracker 

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



[issue43799] OpenSSL 3.0.0: define OPENSSL_API_COMPAT 1.1.1

2021-12-03 Thread Ivan Pozdeev

Ivan Pozdeev  added the comment:

@christian.heimes https://github.com/python/cpython/pull/25481 also needs 
backporting to 3.9 and 3.8.

A Pyenv user has been affected by the "implicit declaration of function 
‘SSLv3_method’" compliation error that it fixes in 3.9.9: 
https://github.com/pyenv/pyenv/issues/2181

--
nosy: +ivan.pozdeev.gm

___
Python tracker 

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



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

2021-12-03 Thread Andrei Kulakov


New submission from Andrei Kulakov :

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

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

___
Python tracker 

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



  1   2   >