[issue44096] Bad clang detection in configure script

2021-05-09 Thread Rishav Kundu

New submission from Rishav Kundu :

Because autoconf detects `cc` before `clang` [1], this means that most of the 
checks in configure.ac that compare $CC to `clang` don’t work. This in turn 
means that things like LTO and PGO don’t work — the appropriate compiler 
options do not get set.

I can write a patch if someone can reproduce this.

[1]: 
https://www.gnu.org/software/autoconf/manual/autoconf-2.62/html_node/C-Compiler.html

--
components: Build
messages: 393354
nosy: xrisk
priority: normal
severity: normal
status: open
title: Bad clang detection in configure script

___
Python tracker 

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



[issue44076] issue with list in Python 3.8.5

2021-05-09 Thread Shreyan Avigyan


Shreyan Avigyan  added the comment:

It doesn't seem to be a Python bug at all. This is pretty awkward that even 
without upgrading your Python your program is breaking. I don't know tkinter 
well but upgrading your Windows shouldn't affect tkinter at all. And as Steven 
described if that was the case IDLE wouldn't work and there would lot's of 
reports and issues like this.

--

___
Python tracker 

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



[issue44094] Remove PyErr_Set...WithUnicodeFilename APIs

2021-05-09 Thread Inada Naoki


Change by Inada Naoki :


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

___
Python tracker 

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



[issue44095] Add suffix property to zipfile.Path

2021-05-09 Thread Jakub Nowak


New submission from Jakub Nowak :

suffix property is present on pathlib.Path (specifically pathlib.PurePath) and 
it could also be added to zipfile.Path for consistency.

My use case is filtering files by suffix:
patch_files = list(filter(lambda file: file.suffix == '.patch', files))

Besides suffix also most of the other pathlib.PurePath properties and methods 
could be added.

--
components: Library (Lib)
messages: 393352
nosy: MrQubo
priority: normal
severity: normal
status: open
title: Add suffix property to zipfile.Path
type: enhancement
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



[issue44094] Remove PyErr_Set...WithUnicodeFilename APIs

2021-05-09 Thread Inada Naoki


New submission from Inada Naoki :

These APIs are deprecated since Python 3.3. They are not documented too.

```
#ifdef MS_WINDOWS
Py_DEPRECATED(3.3)
PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithUnicodeFilename(
PyObject *, const Py_UNICODE *);

/* XXX redeclare to use WSTRING */
Py_DEPRECATED(3.3)
PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithUnicodeFilename(
int, const Py_UNICODE *);
Py_DEPRECATED(3.3)
PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithUnicodeFilename(
PyObject *,int, const Py_UNICODE *);
#endif
```

--
components: C API
messages: 393351
nosy: methane
priority: normal
severity: normal
status: open
title: Remove PyErr_Set...WithUnicodeFilename APIs
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



[issue41692] Deprecate immortal interned strings: PyUnicode_InternImmortal()

2021-05-09 Thread Inada Naoki


Inada Naoki  added the comment:

For the record, I noticed PyUnicode_InternImmortal() is a stable ABI.

We may need to keep the function to avoid dynamic link errors.
But we can still change its implementation to just raise an exception.

--

___
Python tracker 

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



[issue44093] compiler detection on macOS seems to be incorrect

2021-05-09 Thread Ned Deily


Change by Ned Deily :


--
assignee:  -> ned.deily
components: +macOS
nosy: +ned.deily, ronaldoussoren

___
Python tracker 

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



[issue44090] Add class binding to unbound super objects for allowing autosuper with class methods

2021-05-09 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Do we have any meaningful examples to show that this is desired and useful? 

The primary use case for classmethods is to serve as alternate constructors 
that return new instances.  That doesn't really lend itself to extending in a 
subclass.  User's can already call a parent class directly without super(), but 
I don't think I've ever encountered a single example of someone doing so with a 
classmethod such as dict.fromkeys() or datetime.fromtimestamp().

--

___
Python tracker 

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



[issue42115] Caching infrastructure for the evaluation loop: specialised opcodes

2021-05-09 Thread Guido van Rossum


Guido van Rossum  added the comment:

Moving the needle on the pyperformance benchmarks is really hard!

--

___
Python tracker 

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



[issue44028] Request for locals().update() to work, it is

2021-05-09 Thread wang xuancong


wang xuancong  added the comment:

Thanks @terry.reedy for your expert-level good comments!

1.
"In Python 3, the one *implementation*, and its lookup mode, are fixed.  The 
slower implementation was dropped because it was not thought worth the bother."
If I remember correctly, the performance penalty due to the slower lookup mode 
is not quite significant, in most Python benchmarks, Python2 still performs 
much faster than Python3 because most codes that need speed does not contain 
exec/eval, so the slow mode won't affect in practice.

2.
"When you invoke the save function while playing a game, I am imagine that the 
save function does not have access to and does not same the locals of whatever 
function was executing at the time you hit the save key.  Rather a game and 
player states are serialized, and likely not in one line of code."
I have personally tried this on one implementation of deep neural network using 
Tensorflow, it works pretty well, especially on saving the network parameters 
at every Nth epoch, or resuming training from a particular epoch. The biggest 
advantage is that it does not scale with network size or complexity, so the 
Python code size has a O(1) complexity with network size/complexity and that is 
a small constant O(1) as it does not involve any Python loop. In practice, you 
can select what to save/load, such as those not starting with '_'.

--

___
Python tracker 

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



[issue44090] Add class binding to unbound super objects for allowing autosuper with class methods

2021-05-09 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
nosy: +rhettinger

___
Python tracker 

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



[issue44093] compiler detection on macOS seems to be incorrect

2021-05-09 Thread Rishav Kundu

New submission from Rishav Kundu :

On macOS devices, the configure script seems to always detect gcc, even though 
Apple does not ship with gcc — the gcc binary is simply a wrapper around clang 
(probably llvm-gcc?)

I believe the issue is with these lines.

https://github.com/python/cpython/blob/8e8307d70bb9dc18cfeeed3277c076309b27515e/configure.ac#L630-L635

Concretely, gcc —-version produces this on my computer:

$ gcc --version
Configured with: --prefix=/Library/Developer/CommandLineTools/usr 
--with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 12.0.5 (clang-1205.0.22.9)
Target: x86_64-apple-darwin20.4.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

Perhaps an additional check for “clang” would solve the issue.

--
components: Build
messages: 393346
nosy: xrisk
priority: normal
severity: normal
status: open
title: compiler detection on macOS seems to be incorrect
type: behavior
versions: Python 3.10, Python 3.11, 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



[issue44076] issue with list in Python 3.8.5

2021-05-09 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

On Sun, May 09, 2021 at 11:55:56PM +, Mohamed wrote:

> Please find attached, the demo with dummy data. As I mentioned, it was 
> working fine until May 1st. 

If it was working fine until May 1st, I would start my investigation by 
looking at what changes where made to the source code on April 29, 30 
and May 1st.

Is your source code in a source control repository? Can you compare it 
to a backup?

> Also, As I mentioned, in case I call MasterApp at the end of add 
> function data appears correctly. This means a malfunction occurred 
> after Windows Update, and it relates to mainloop

Your traceback involves a keyerror and an index error. What makes you 
think this is a problem with the Tkinter mainloop rather than your own 
code?

You are trying to delete a module from sys.modules:

del sys.modules['cm_asset_add']

(why?) but the key is not found. That exception is then caught and 
another exception raised.

It really looks to me that your callback function fun_asset_current is 
buggy. Why is it messing with sys.modules?

> class MasterApp(object):
> def __init__(self, root):
> 
> 
> def fun_astinfo_add(self):
>   ...
>   assetinfo_lst.append(lst_values)
>   ...
>   MasterApp(root)

I'm not an expert at tkinter, but creating a new MasterApp object 
every single time you call the fun_astinfo_add method doesn't look 
right to me -- especially since you create that object, but then 
immediately discard it and it is instantly garbage collected.

--

___
Python tracker 

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



[issue44076] issue with list in Python 3.8.5

2021-05-09 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

On Sun, May 09, 2021 at 10:04:29PM +, Mohamed wrote:

> As I mentioned, It seems that the recent update of Windows has affected 
> Tkinter, 
> so that mainloop is not working after the first time

That isn't what it looks like to me. If updating Windows had affected 
Tkinter, IDLE would no longer work and there would be thousands of 
people affected. I see no sign that this is the case:

https://duckduckgo.com/?q=latest+update+of+windows+breaks+tkinter

It would be very, very suprising if you were the only person who has 
noticed that a Windows update broke Tkinter.

Mohamed, you said that you had done an investigation which showed memory 
corruption. What is your evidence for memory corruption?

So far there is no evidence for a bug in Tkinter or Python. This is not 
a help desk. There are many forums where you can get help debugging your 
program, you should create a minimal example and ask for help at

https://www.reddit.com/r/learnpython/

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

news:comp.lang.python

https://discuss.python.org/c/users/7

https://www.python.org/community/irc/

No matter which forum you go to, you will be asked for a minimal example 
demonstrating the problem:

http://www.sscce.org/

https://stackoverflow.com/help/minimal-reproducible-example

https://ericlippert.com/2014/03/05/how-to-debug-small-programs/

https://medium.com/swlh/how-to-ask-smart-questions-d02f053a02ac

http://www.catb.org/esr/faqs/smart-questions.html

Note that a minimal program **MUST** be runnable. There is no point just 
deleting lines of code and replacing them with "...", because the code 
won't run.

--

___
Python tracker 

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



[issue44076] issue with list in Python 3.8.5

2021-05-09 Thread Mohamed


Mohamed  added the comment:

Please find attached, the demo with dummy data. As I mentioned, it was working 
fine until May 1st. 
Also, As I mentioned, in case I call MasterApp at the end of add function data 
appears correctly. This means a malfunction occurred after Windows Update, and 
it relates to mainloop

class MasterApp(object):
def __init__(self, root):


def fun_astinfo_add(self):
...
assetinfo_lst.append(lst_values)
...
MasterApp(root)

...
if __name__ == "__main__":
root = Tk()
App = MasterApp(root)
root.mainloop()

--
Added file: https://bugs.python.org/file50030/Issue in Tkinter with Python 2.pdf

___
Python tracker 

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



[issue40222] "Zero cost" exception handling

2021-05-09 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

I tried some debugging code:

diff --git a/Python/ceval.c b/Python/ceval.c
index f745067069..a8668dbac2 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -4864,6 +4864,18 @@ get_exception_handler(PyCodeObject *code, int index)
 return res;
 }
 scan = skip_to_next_entry(scan);
+if (scan
+>= (unsigned char *)PyBytes_AS_STRING(code->co_exceptiontable)
++ PyBytes_GET_SIZE(code->co_exceptiontable))
+{
+printf("co_name: --\n");
+_PyObject_Dump(code->co_name);
+printf("co_filename: --\n");
+_PyObject_Dump(code->co_filename);
+printf("co_exceptiontable: -\n");
+_PyObject_Dump(code->co_exceptiontable);
+printf("\n\n\n\n\n");
+}
 }
 res.b_handler = -1;
 return res;


It output this:

Python 3.11.0a0 (heads/main-dirty:092f9ddb5e, May  9 2021, 18:45:56) [MSC 
v.1927 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from test.test_statistics import *
co_name: --
object address  : 0254B63EFB80
object refcount : 7
object type : 7FFA1C7E71C0
object type name: str
object repr : '_find_and_load'
co_filename: --
object address  : 0254B63967A0
object refcount : 76
object type : 7FFA1C7E71C0
object type name: str
object repr : ''
co_exceptiontable: -
object address  : 0254B63EB290
object refcount : 1
object type : 7FFA1C7C9A40
object type name: bytes
object repr : b'\x84\x10"\x03\xa2\x04&\x0b\xa7\x03&\x0b'


>>> unittest.main()

--
Ran 364 tests in 24.409s

OK


Here is the disassembly of the offending function:

>>> from dis import dis
>>> from importlib._bootstrap import _find_and_load
>>> dis(_find_and_load)
1024   0 LOAD_GLOBAL  0 (_ModuleLockManager)
   2 LOAD_FAST0 (name)
   4 CALL_FUNCTION1
   6 BEFORE_WITH
   8 POP_TOP

1025  10 LOAD_GLOBAL  1 (sys)
  12 LOAD_ATTR2 (modules)
  14 LOAD_METHOD  3 (get)
  16 LOAD_FAST0 (name)
  18 LOAD_GLOBAL  4 (_NEEDS_LOADING)
  20 CALL_METHOD  2
  22 STORE_FAST   2 (module)

1026  24 LOAD_FAST2 (module)
  26 LOAD_GLOBAL  4 (_NEEDS_LOADING)
  28 IS_OP0
  30 POP_JUMP_IF_FALSE   27 (to 54)

1027  32 LOAD_GLOBAL  5 (_find_and_load_unlocked)
  34 LOAD_FAST0 (name)
  36 LOAD_FAST1 (import_)
  38 CALL_FUNCTION2

1024  40 ROT_TWO
  42 LOAD_CONST   1 (None)
  44 DUP_TOP
  46 DUP_TOP
  48 CALL_FUNCTION3
  50 POP_TOP

1027  52 RETURN_VALUE

1026 >>   54 NOP

1024  56 LOAD_CONST   1 (None)
  58 DUP_TOP
  60 DUP_TOP
  62 CALL_FUNCTION3
  64 POP_TOP
  66 JUMP_FORWARD11 (to 90)
 >>   68 PUSH_EXC_INFO
  70 WITH_EXCEPT_START
  72 POP_JUMP_IF_TRUE39 (to 78)
  74 RERAISE  4
 >>   76 POP_EXCEPT_AND_RERAISE
 >>   78 POP_TOP
  80 POP_TOP
  82 POP_TOP
  84 POP_EXCEPT
  86 POP_TOP
  88 POP_TOP

1029 >>   90 LOAD_FAST2 (module)
  92 LOAD_CONST   1 (None)
  94 IS_OP0
  96 POP_JUMP_IF_FALSE   60 (to 120)

1030  98 LOAD_CONST   2 ('import of {} halted; None in 
sys.modules')

1031 100 LOAD_METHOD  6 (format)
 102 LOAD_FAST0 (name)
 104 CALL_METHOD  1

1030 106 STORE_FAST   3 (message)

1032 108 LOAD_GLOBAL  7 (ModuleNotFoundError)
 110 LOAD_FAST3 (message)
 112 LOAD_FAST0 (name)
 114 LOAD_CONST   3 (('name',))
 116 CALL_FUNCTION_KW 2
 118 

[issue44076] issue with list in Python 3.8.5

2021-05-09 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

Hi Mohamed,

>From the output it looks like the app is trying to get item at index 28
from assetinfo_list, while that list is of only 17 length. So it seems
likely that either app is not inserting enough items into assetinfo_list,
or you are clicking on treedata.selection at a higher item than there are
assets for in the list, or something is going wrong with associating click
with the selection number.

To get further help, I think you will need to create a minimal runnable
example that shows the issue and upload it here.

--

___
Python tracker 

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



[issue44076] issue with list in Python 3.8.5

2021-05-09 Thread Mohamed


Mohamed  added the comment:

I made changes but result is same:

xrec = self.treedata.selection()[0]
xrec = int(xrec[1:], 16) - 1

print('xrec: ', xrec)
itemXid = assetinfo_lst[xrec]
itemXid = itemXid[1]



Exception in Tkinter callback
Traceback (most recent call last):
File 
"C:\Users\xx\AppData\Local\Programs\Python\Python38-32\lib\tkinter\__init__.py",
 line 1883, in __call__
return self.func(*args)
File "xx.py", line 1463, in OnDoubleClick
itemXid = assetinfo_lst[xrec]
IndexError: list index out of range

length of assetinfo_lst before a new insert: 16
length of assetinfo_lst after a new insert: 17
xrec:  xrec:  28


As I mentioned, It seems that the recent update of Windows has affected 
Tkinter, 
so that mainloop is not working after the first time

--

___
Python tracker 

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



[issue44092] [sqlite3] consider removing special rollback handling

2021-05-09 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

Attached patch includes the test case from bpo-33376.

--

___
Python tracker 

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



[issue44092] [sqlite3] consider removing special rollback handling

2021-05-09 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
keywords: +patch
Added file: https://bugs.python.org/file50029/patch.diff

___
Python tracker 

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



[issue44092] [sqlite3] consider removing special rollback handling

2021-05-09 Thread Erlend E. Aasland


New submission from Erlend E. Aasland :

Ref. bpo-33376 and bpo-10513.

Quoting from the SQLite 3.7.11 changelog[1]:
"Pending statements no longer block ROLLBACK. Instead, the pending statement 
will return SQLITE_ABORT upon next access after the ROLLBACK."

Quoting from the SQLite 3.8.7.2 changelog[2]:
"Enhance the ROLLBACK command so that pending queries are allowed to continue 
as long as the schema is unchanged. Formerly, a ROLLBACK would cause all 
pending queries to fail with an SQLITE_ABORT or SQLITE_ABORT_ROLLBACK error. 
That error is still returned if the ROLLBACK modifies the schema."

Quoting from the SQLite docs[3]:
"In more recent versions of SQLite, the ROLLBACK will proceed and pending 
statements will often be aborted, causing them to return an SQLITE_ABORT or 
SQLITE_ABORT_ROLLBACK error. In SQLite version 3.8.8 (2015-01-16) and later, a 
pending read will continue functioning after the ROLLBACK as long as the 
ROLLBACK does not modify the database schema."

I've done some tests with SQLite versions 3.35.4 and 3.7.15 where I've removed 
the call to pysqlite_do_all_statements() (introduced by [4]) in 
pysqlite_connection_rollback_impl(), and I've also removed the 
pysqlite_Cursor.reset member and all of the related code. The test suite passes 
fine (except for, as expected, the two tests that check for InterfaceError in 
case of fetch across rollback).

Do we really need to special case rollbacks anymore? I've tried to come up with 
tests that prove this approach wrong, but I haven't found any yet.


[1] https://sqlite.org/changes.html#version_3_7_11
[2] https://sqlite.org/changes.html#version_3_8_7_2
[3] https://www.sqlite.org/lang_transaction.html
[4] 
https://github.com/ghaering/pysqlite/commit/95f0956d9a78750ac8b5ca54f028b5f8d8db0abb

--
components: Extension Modules
messages: 393338
nosy: berker.peksag, erlendaasland, lemburg, serhiy.storchaka
priority: normal
severity: normal
status: open
title: [sqlite3] consider removing special rollback handling
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



[issue43149] Misleading error message for except with missing parens (3.10.a5)

2021-05-09 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 9a0e65c8e05fdcd2207650d216ebdacdf0a025e9 by Miss Islington (bot) 
in branch '3.10':
bpo-43149: Correct the syntax error message for multiple exception types 
(GH-25996) GH-25997)
https://github.com/python/cpython/commit/9a0e65c8e05fdcd2207650d216ebdacdf0a025e9


--

___
Python tracker 

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



[issue43389] Cancellation ignored by asyncio.wait_for can hang application

2021-05-09 Thread nmatravolgyi


Change by nmatravolgyi :


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



[issue42130] AsyncIO's wait_for can hide cancellation in a rare race condition

2021-05-09 Thread nmatravolgyi


nmatravolgyi  added the comment:

I've also found this deficiency of asyncio.wait_for by debugging an obscure 
hang in an application. Back then I've quickly made an issue about it: 
https://bugs.python.org/issue43389

I've just closed it as duplicate, since this issue covers the same bug and has 
been around longer.

I'm surprised this issue has not got more attention. This definitely needs a 
fix. Ignoring a CancellationError is something that is heavily discouraged by 
the documentation in general. Silently ignoring/eating a cancellation makes 
this construct unreliable without good workarounds, aside from not using it.

For a specific application, this was so broken, that I had to come up with a 
fix in the short term. I made an asyncio.wait_for variant available as a 
library that fixes the problem: https://github.com/Traktormaster/wait-for2

The repository has a detailed description of the issue and the way it fixes it. 
It also has test cases to assert the behaviour of the builtin and the fixed 
wait_for construct from the library.

--
nosy: +nmatravolgyi

___
Python tracker 

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



[issue43389] Cancellation ignored by asyncio.wait_for can hang application

2021-05-09 Thread nmatravolgyi


nmatravolgyi  added the comment:

Closing as duplicate, because there was already an issue for this bug: 
https://bugs.python.org/issue42130

--
resolution:  -> duplicate

___
Python tracker 

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



[issue43109] When using Apple Clang, --with-lto builds should not check for llvm-ar

2021-05-09 Thread Ned Deily


Ned Deily  added the comment:

Thanks for the PR. I am looking at this area currently.

--

___
Python tracker 

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



[issue43109] When using Apple Clang, --with-lto builds should not check for llvm-ar

2021-05-09 Thread Ned Deily


Change by Ned Deily :


--
assignee:  -> ned.deily
components: +macOS
nosy: +ned.deily, ronaldoussoren

___
Python tracker 

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



[issue44084] Can't mark match, case, _ as keywords in docs

2021-05-09 Thread Tal Einat


Change by Tal Einat :


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



[issue44080] Bias in random.choices(long_sequence)

2021-05-09 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

FWIW, the principal use case that choices() was designed for is 
resampling/bootstapping.  In that use case, speed matters and small imbalances 
in large sequences don't matter at all.  Also, the API was designed to make it 
easy to select from an itemized population of individuals than a large range 
followed by a modulo calculation (we already have randrange() to meet that 
need).

I could add a sentence to the last paragraph recommending "[choice(pop) for i 
in range(k)]" for the case where 1)  the population is large, 2) the speed 
doesn't matter, 3) the weights are equal, and 4) integer math is desired to 
avoid any trace of bias.  That said, I don't users would benefit from it and 
that this is largely just a theoretical concern that doesn't warrant more than 
the existing paragraph.

--

___
Python tracker 

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



[issue44084] Can't mark match, case, _ as keywords in docs

2021-05-09 Thread Tal Einat


Tal Einat  added the comment:

Thanks Dominic, it seems that you're absolutely right!

--

___
Python tracker 

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



[issue41930] Wrap sqlite3_serialize API in sqlite3 module

2021-05-09 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

FYI, this was just checked into the SQLite fossil repo:

$ fossil update trunk
updated-to:   6df3b03e00b1143be8fed3a39a58ce8106302027 2021-05-08 17:18:23 UTC
tags: trunk
comment:  Enable the sqlite3_serialize() and sqlite3_deserialize() 
interfaces by default. Omit the SQLITE_ENABLE_DESERIALIZE option and replace it 
with the SQLITE_OMIT_DESERIALIZE option. (user: drh)


Ref. the SQLite docs: https://www.sqlite.org/compile.html#enable_deserialize
"Future releases of SQLite might enable those interfaces by default and instead 
offer an SQLITE_OMIT_DESERIALIZE option to leave them out."

--

___
Python tracker 

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



[issue44084] Can't mark match, case, _ as keywords in docs

2021-05-09 Thread Dominic Davis-Foster


Dominic Davis-Foster  added the comment:

I'm not sure this is a Pygments or Sphinx bug. The documentation for the 
:keyword: role[1] says:

   This creates a link to a reference label with that name, if it exists.


Looking at the documentation source for "Compound statements"[2] each section 
for a particular keyword is preceded by a reference label for the relevant 
keyword(s).

So for "match" and "case" all that's needed is to put the label before the 
section of the docs talking about them.
In fact, it seems that "match" does have a label[3], and I can link to it 
successfully; it's just "case" and "_" that don't work

"_" is more tricky, as you can't have a reference label called that. However, 
if you pick another name for the label (say, "underscore") you can use that as 
the target name and still have "_" as the text like so:

:keyword:`_ `


[1] 
https://www.sphinx-doc.org/en/master/usage/restructuredtext/roles.html#role-keyword
[2] 
https://raw.githubusercontent.com/python/cpython/main/Doc/reference/compound_stmts.rst
[3] 
https://github.com/python/cpython/blame/main/Doc/reference/compound_stmts.rst#L514

--
nosy: +dom1310df

___
Python tracker 

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



[issue44080] Bias in random.choices(long_sequence)

2021-05-09 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

This is known and an intentional design decision.  It isn't just a speed issue. 
 Because the weights can be floats, we have floats involved at the outset and 
some round-off is unavoidable.  To keep the method internally consistent, the 
same technique is used even when the weights aren't specified:

>>> from random import choices, seed
>>> seed(8675309**3)
>>> s = choices('abcdefg', k=20)
>>> seed(8675309**3)
>>> t = choices('abcdefg', [0.7] * 7, k=20)
>>> s == t
True

FWIW, this is documented: 
"""
For a given seed, the choices() function with equal weighting typically 
produces a different sequence than repeated calls to choice(). The algorithm 
used by choices() uses floating point arithmetic for internal consistency and 
speed. The algorithm used by choice() defaults to integer arithmetic with 
repeated selections to avoid small biases from round-off error.
"""

--
assignee:  -> rhettinger
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



[issue44091] traceback & inspect modules should verify that the .py source file matches the one that the running process is using

2021-05-09 Thread Gregory P. Smith


New submission from Gregory P. Smith :

A long-standing wart in Python is that once a module is loaded, when rendering 
a traceback and including source lines, we do not verify if the source file 
we're loading is the same as the one representing the code we are running.

It could have been replaced.  As is normal during software upgrades.

If our code was loaded from .py source, we should be recording the 
timestamp/size||hash of the source file and referencing that from each code 
object.  If our code was loaded from a .pyc source, the .pyc already contains a 
timestamp/size||hash for the corresponding .py source file that could be 
referenced.

When traceback.StackSummary and FrameSummary use the linecache module, we 
should plumb this source metainfo in from the relevant code object.

A traceback being rendered with potentially modified source code could choose 
to omit the source lines, or at least annotate them with a "  ## this source 
{timestamp/size||hash} does not match the running code {timestamp/size||hash}." 
marker so that anyone seeing the traceback knows the displayed line may not be 
trustworthy.  (If the pyc was written using the "unchecked-hash" mode, no 
source/pyc synchronization check should be made)

The inspect module also needs the ability to do indicate this to the caller.

--
components: Library (Lib)
messages: 393328
nosy: gregory.p.smith
priority: normal
severity: normal
stage: needs patch
status: open
title: traceback & inspect modules should verify that the .py source file 
matches the one that the running process is using
type: enhancement
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



[issue44080] Bias in random.choices(long_sequence)

2021-05-09 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

Your suspicion looks correct, random() is faster:

.\python.bat -m pyperf timeit -s "from random import choices" 
"choices(range(100), k=10_000)"

Before int_choices.diff: Mean +- std dev: 1.49 ms +- 0.09 ms
After int_choices.diff:  Mean +- std dev: 3.50 ms +- 0.33 ms

--
keywords: +patch
Added file: https://bugs.python.org/file50028/int_choices.diff

___
Python tracker 

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



[issue44090] Add class binding to unbound super objects for allowing autosuper with class methods

2021-05-09 Thread Géry

Change by Géry :


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

___
Python tracker 

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



[issue43853] [sqlite3] Improve sqlite3_value_text() error handling

2021-05-09 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
title: [sqlite3] Fix sqlite3_value_text() usage -> [sqlite3] Improve 
sqlite3_value_text() error handling

___
Python tracker 

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



[issue44090] Add class binding to unbound super objects for allowing autosuper with class methods

2021-05-09 Thread Géry

New submission from Géry :

A use case of one-argument `super` (aka unbound `super`) is Guido van Rossum’s 
autosuper described in his 2002 article [*Unifying types and classes in Python 
2.2*](https://www.python.org/download/releases/2.2.3/descrintro/#cooperation).

It works with functions, but not with `classmethod` as Michele Simionato noted 
in his 2008 article [*Things to Know About Python 
Super*](https://www.artima.com/weblogs/viewpost.jsp?thread=236278).

I suggest fixing this by updating the method `super.__get__` to bind an unbound 
`super` object to the argument `owner` when there is no argument `instance` to 
bind to. Here is the patch applied to the C function 
[super_descr_get](https://github.com/python/cpython/blob/v3.9.5/Objects/typeobject.c#L8029-L8061)
 in Objects/typeobject.c, given in pure Python for better readability:

```python
def __get__(self, instance, owner=None):
if instance is None and owner is None:
raise TypeError('__get__(None, None) is invalid')
-   if instance is None or self.__self__ is not None:
+   if self.__self__ is not None:
return self
+   if instance is None:
+   return type(self)(self.__thisclass__, owner)
return type(self)(self.__thisclass__, instance)
```

Demonstration:

```python
>>> class A:
... def f(self): return 'A.f'
... @classmethod
... def g(cls): return 'A.g'
... 
>>> class B(A):
... def f(self): return 'B.f ' + self.__super.f()
... @classmethod
... def g(cls): return 'B.g ' + cls.__super.g()
... 
>>> B._B__super = super(B)  # the CURRENT broken version of super
>>> print(B().f())  # function succeeds (instance binding)
B.f A.f
>>> print(B.g())# classmethod fails (no binding)
Traceback (most recent call last):
  File "", line 1, in 
  File "", line 4, in g
AttributeError: 'super' object has no attribute 'g'
>>> B._B__super = super(B)  # the PROPOSED fixed version of super
>>> print(B().f())  # function succeeds (instance binding)
B.f A.f
>>> print(B.g())# classmethod succeeds (class binding)
B.g A.g
```

--
components: Interpreter Core
messages: 393326
nosy: maggyero
priority: normal
severity: normal
status: open
title: Add class binding to unbound super objects for allowing autosuper with 
class methods
type: enhancement
versions: Python 3.10, Python 3.11, Python 3.9

___
Python tracker 

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



[issue44076] issue with list in Python 3.8.5

2021-05-09 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

Hi Mohamed, you can try changing the following line:

itemXid = assetinfo_lst[xrec][1]

to:

print('xrec',xrec)
itemXid = assetinfo_lst[xrec]
itemXid = itemXid[1]

This will show you if the index error is caused by xrec or by [1] lookup. If 
caused by xrec lookup, you will see what xrec value is at this point.

--
nosy: +andrei.avk

___
Python tracker 

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



[issue40222] "Zero cost" exception handling

2021-05-09 Thread Ammar Askar


Ammar Askar  added the comment:

Seconded, also seeing the same ASAN failure on the fuzzers with a blame for 
this commit.

--
nosy: +ammar2

___
Python tracker 

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



[issue32958] socket module calls with long host names can fail with idna codec error

2021-05-09 Thread Ben Darnell


Ben Darnell  added the comment:

[I'm coming here from https://github.com/tornadoweb/tornado/pull/3010)

UnicodeError is a subclass of ValueError, so I don't see what value that change 
would provide. The thing that's surprising to me is that it's not a 
`socket.herror` (or `gaierror` for socket.getaddrinfo). I guess the docs don't 
formally say that `herror`/`gaierror` is the *only* possible error from these 
functions, but `gaierror` was the only error I was catching so the unexpected 
UnicodeError escaped the layer that was intended to handle it. 

I do think that in the special case of `getaddrinfo` with the `AI_NUMERICHOST` 
flag it should be handled differently: in that mode there is no network access 
necessary and it's reasonable to assume that the only possible error is a 
`gaierror` with `EAI_NONAME`. 

I'd like to at least see better documentation about what errors are possible 
from this family of functions.

--
nosy: +Ben.Darnell

___
Python tracker 

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



[issue40222] "Zero cost" exception handling

2021-05-09 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

To reproduce with a modern gcc:

% export ASAN_OPTIONS=detect_leaks=0:allocator_may_return_null=1:handle_segv=0
% ./configure --with-address-sanitizer --without-pymalloc
% make -j -s
% ./python -m test test_statistics
=
==51490==ERROR: AddressSanitizer: heap-buffer-overflow on address 
0x604113fd at pc 0x564ec89e0edc bp 0x7ffcba70 sp 0x7ffcba60
READ of size 1 at 0x604113fd thread T0
#0 0x564ec89e0edb in skip_to_next_entry Python/ceval.c:4798
#1 0x564ec89e0edb in get_exception_handler Python/ceval.c:4866
#2 0x564ec89e0edb in _PyEval_EvalFrameDefault Python/ceval.c:4465
#3 0x564ec8be30d7 in _PyEval_EvalFrame Include/internal/pycore_ceval.h:46
#4 0x564ec8be30d7 in _PyEval_Vector Python/ceval.c:5160
#5 0x564ec8a2b22e in _PyObject_VectorcallTstate 
Include/cpython/abstract.h:114
#6 0x564ec8a2b22e in object_vacall Objects/call.c:734
#7 0x564ec8a30c50 in _PyObject_CallMethodIdObjArgs Objects/call.c:825
#8 0x564ec8c5bdd7 in import_find_and_load Python/import.c:1499
#9 0x564ec8c5bdd7 in PyImport_ImportModuleLevelObject Python/import.c:1600
#10 0x564ec89ea39b in import_name Python/ceval.c:6101
#11 0x564ec89ea39b in _PyEval_EvalFrameDefault Python/ceval.c:3693
#12 0x564ec8be29ea in _PyEval_EvalFrame Include/internal/pycore_ceval.h:46
#13 0x564ec8be29ea in _PyEval_Vector Python/ceval.c:5160
#14 0x564ec8be29ea in PyEval_EvalCode Python/ceval.c:1136


--

___
Python tracker 

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



[issue40222] "Zero cost" exception handling

2021-05-09 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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



[issue40222] "Zero cost" exception handling

2021-05-09 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

This seems to have broken the address sanitizer buildbot:

https://buildbot.python.org/all/#/builders/582/builds/116/steps/5/logs/stdio

Example error:


==28597==ERROR: AddressSanitizer: heap-buffer-overflow on address 
0x60411cbd at pc 0x55e7e3cceedc bp 0x7ffc74448490 sp 0x7ffc74448480
READ of size 1 at 0x60411cbd thread T0
#0 0x55e7e3cceedb in skip_to_next_entry Python/ceval.c:4798
#1 0x55e7e3cceedb in get_exception_handler Python/ceval.c:4866
#2 0x55e7e3cceedb in _PyEval_EvalFrameDefault Python/ceval.c:4465
#3 0x55e7e3ed10d7 in _PyEval_EvalFrame Include/internal/pycore_ceval.h:46
#4 0x55e7e3ed10d7 in _PyEval_Vector Python/ceval.c:5160
#5 0x55e7e3d1922e in _PyObject_VectorcallTstate 
Include/cpython/abstract.h:114
#6 0x55e7e3d1922e in object_vacall Objects/call.c:734
#7 0x55e7e3d1ec50 in _PyObject_CallMethodIdObjArgs Objects/call.c:825
#8 0x55e7e3f49dd7 in import_find_and_load Python/import.c:1499
#9 0x55e7e3f49dd7 in PyImport_ImportModuleLevelObject Python/import.c:1600
#10 0x55e7e3cd839b in import_name Python/ceval.c:6101
#11 0x55e7e3cd839b in _PyEval_EvalFrameDefault Python/ceval.c:3693
#12 0x55e7e3ed09ea in _PyEval_EvalFrame Include/internal/pycore_ceval.h:46
#13 0x55e7e3ed09ea in _PyEval_Vector Python/ceval.c:5160
#14 0x55e7e3ed09ea in PyEval_EvalCode Python/ceval.c:1136
#15 0x55e7e420b908 in builtin_exec_impl Python/bltinmodule.c:1065
#16 0x55e7e420b908 in builtin_exec Python/clinic/bltinmodule.c.h:371
#17 0x55e7e4196590 in cfunction_vectorcall_FASTCALL 
Objects/methodobject.c:426
#18 0x55e7e3d1a592 in PyVectorcall_Call Objects/call.c:255
#19 0x55e7e3cd15f4 in do_call_core Python/ceval.c:6028
#20 0x55e7e3cd15f4 in _PyEval_EvalFrameDefault Python/ceval.c:4283
#21 0x55e7e3ed10d7 in _PyEval_EvalFrame Include/internal/pycore_ceval.h:46
#22 0x55e7e3ed10d7 in _PyEval_Vector Python/ceval.c:5160
#23 0x55e7e3cd424e in _PyObject_VectorcallTstate 
Include/cpython/abstract.h:114
#24 0x55e7e3cd424e in PyObject_Vectorcall Include/cpython/abstract.h:123
#25 0x55e7e3cd424e in call_function Python/ceval.c:5976
#26 0x55e7e3cd424e in _PyEval_EvalFrameDefault Python/ceval.c:4187
#27 0x55e7e3ed10d7 in _PyEval_EvalFrame Include/internal/pycore_ceval.h:46
#28 0x55e7e3ed10d7 in _PyEval_Vector Python/ceval.c:5160
#29 0x55e7e3cd4384 in _PyObject_VectorcallTstate 
Include/cpython/abstract.h:114
#30 0x55e7e3cd4384 in PyObject_Vectorcall Include/cpython/abstract.h:123
#31 0x55e7e3cd4384 in call_function Python/ceval.c:5976
#32 0x55e7e3cd4384 in _PyEval_EvalFrameDefault Python/ceval.c:4204
#33 0x55e7e3ed10d7 in _PyEval_EvalFrame Include/internal/pycore_ceval.h:46
#34 0x55e7e3ed10d7 in _PyEval_Vector Python/ceval.c:5160
#35 0x55e7e3ce0934 in _PyObject_VectorcallTstate 
Include/cpython/abstract.h:114
#36 0x55e7e3ce0934 in PyObject_Vectorcall Include/cpython/abstract.h:123
#37 0x55e7e3ce0934 in call_function Python/ceval.c:5976
#38 0x55e7e3ce0934 in _PyEval_EvalFrameDefault Python/ceval.c:4219
#39 0x55e7e3ed10d7 in _PyEval_EvalFrame Include/internal/pycore_ceval.h:46
#40 0x55e7e3ed10d7 in _PyEval_Vector Python/ceval.c:5160
#41 0x55e7e3ce0934 in _PyObject_VectorcallTstate 
Include/cpython/abstract.h:114
#42 0x55e7e3ce0934 in PyObject_Vectorcall Include/cpython/abstract.h:123
#43 0x55e7e3ce0934 in call_function Python/ceval.c:5976
#44 0x55e7e3ce0934 in _PyEval_EvalFrameDefault Python/ceval.c:4219
#45 0x55e7e3ed10d7 in _PyEval_EvalFrame Include/internal/pycore_ceval.h:46
#46 0x55e7e3ed10d7 in _PyEval_Vector Python/ceval.c:5160
#47 0x55e7e3ce0934 in _PyObject_VectorcallTstate 
Include/cpython/abstract.h:114
#48 0x55e7e3ce0934 in PyObject_Vectorcall Include/cpython/abstract.h:123
#49 0x55e7e3ce0934 in call_function Python/ceval.c:5976
#50 0x55e7e3ce0934 in _PyEval_EvalFrameDefault Python/ceval.c:4219
#51 0x55e7e3ed10d7 in _PyEval_EvalFrame Include/internal/pycore_ceval.h:46
#52 0x55e7e3ed10d7 in _PyEval_Vector Python/ceval.c:5160
#53 0x55e7e3cd424e in _PyObject_VectorcallTstate 
Include/cpython/abstract.h:114
#54 0x55e7e3cd424e in PyObject_Vectorcall Include/cpython/abstract.h:123
#55 0x55e7e3cd424e in call_function Python/ceval.c:5976
#56 0x55e7e3cd424e in _PyEval_EvalFrameDefault Python/ceval.c:4187
#57 0x55e7e3ed10d7 in _PyEval_EvalFrame Include/internal/pycore_ceval.h:46
#58 0x55e7e3ed10d7 in _PyEval_Vector Python/ceval.c:5160
#59 0x55e7e3cd424e in _PyObject_VectorcallTstate 
Include/cpython/abstract.h:114
#60 0x55e7e3cd424e in PyObject_Vectorcall Include/cpython/abstract.h:123
#61 0x55e7e3cd424e in call_function Python/ceval.c:5976
#62 0x55e7e3cd424e in _PyEval_EvalFrameDefault Python/ceval.c:4187
#63 0x55e7e3ed10d7 in _PyEval_EvalFrame 

[issue44089] csv.Error can't be subclassed

2021-05-09 Thread Ken Jin


Change by Ken Jin :


--
keywords: +patch
nosy: +kj
nosy_count: 2.0 -> 3.0
pull_requests: +24659
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/26008

___
Python tracker 

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



[issue44089] csv.Error can't be subclassed

2021-05-09 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +petr.viktorin

___
Python tracker 

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



[issue44089] csv.Error can't be subclassed

2021-05-09 Thread Oleg Hoefling


New submission from Oleg Hoefling :

Due to changes introduced in https://bugs.python.org/issue14935 the `csv.Error` 
can't be subclassed in 3.10. To reproduce:

Python 3.9.4 (default, Apr  6 2021, 00:00:00)
>>> import csv
>>> class C(csv.Error):
... pass


Python 3.10.0b1 (default, May  4 2021, 00:00:00)
>>> import csv
>>> class C(csv.Error):
... pass
... 
Traceback (most recent call last):
  File "", line 1, in 
TypeError: type '_csv.Error' is not an acceptable base type

--
components: Extension Modules
messages: 393320
nosy: hoefling
priority: normal
severity: normal
status: open
title: csv.Error can't be subclassed
versions: Python 3.10, Python 3.11

___
Python tracker 

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



[issue44088] traced line number can be None

2021-05-09 Thread Ned Batchelder


New submission from Ned Batchelder :

Mark, I'm not clear if the line number can still be None in some circumstances. 

With this code (from site.py in the stdlib):

545: def execsitecustomize():
546: """Run custom site specific code, if available."""
547: try:
548: try:
549: import sitecustomize
550: except ImportError as exc:
551: if exc.name == 'sitecustomize':
552: pass
553: else:
554: raise
555: except Exception as err:
556: if sys.flags.verbose:
557: sys.excepthook(*sys.exc_info())
558: else:
559: sys.stderr.write(
560: "Error in sitecustomize; set PYTHONVERBOSE for 
traceback:\n"
561: "%s: %s\n" %
562: (err.__class__.__name__, err))

I get traces with these events and line numbers:

exception 549 (ModuleNotFoundError("No module named 'sitecustomize'"))
line 550
line 551
line 552
return None

Is this what you expected?

--
assignee: Mark.Shannon
messages: 393319
nosy: Mark.Shannon, nedbat
priority: normal
severity: normal
status: open
title: traced line number can be None
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



[issue44083] problem with updated 3.9.5

2021-05-09 Thread Eric V. Smith


Change by Eric V. Smith :


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



[issue32133] documentation: numbers module nitpick

2021-05-09 Thread Irit Katriel


Change by Irit Katriel :


--
keywords: +easy
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 2.7, Python 3.6

___
Python tracker 

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



[issue44083] problem with updated 3.9.5

2021-05-09 Thread Swarnila Chakma


Swarnila Chakma  added the comment:

Okay actually I managed to solve it. Thanks to both of you for helping me out.

--

___
Python tracker 

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



[issue44083] problem with updated 3.9.5

2021-05-09 Thread Shreyan Avigyan


Shreyan Avigyan  added the comment:

What is the input you're giving?

--

___
Python tracker 

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



[issue44083] problem with updated 3.9.5

2021-05-09 Thread Swarnila Chakma


Swarnila Chakma  added the comment:

I'm executing the code by the software PycharmEdu from jetbrains.
I'm actually facing the problem, no matter what input I give in my console, 
it's automatically just printing empty strings. 

How can I solve this?

--

___
Python tracker 

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



[issue42454] Move slice creation to the compiler for constants

2021-05-09 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

I've implemented a new revision that works without making slices hashable. 
Updating PR 23496

--

___
Python tracker 

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



[issue29468] zipfile should catch ValueError as well as OSError to detect bad seek calls

2021-05-09 Thread Irit Katriel


Irit Katriel  added the comment:

Maybe a better option is to change mmap's seek() to raise an OSError, because 
it's supposed to behave like a file object.

--
nosy: +iritkatriel
versions: +Python 3.11 -Python 3.6

___
Python tracker 

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



[issue30076] Opcode names BUILD_MAP_UNPACK_WITH_CALL and BUILD_TUPLE_UNPACK_WITH_CALL are too long

2021-05-09 Thread Ken Jin


Ken Jin  added the comment:

Serhiy, may I close this issue please?

Since 3.10, those long opcodes no longer exist. Issue39320 removed 
BUILD_TUPLE_UNPACK_WITH_CALL and BUILD_MAP_UNPACK_WITH_CALL from the compiler. 
The new opcodes have shorter names.

--
nosy: +kj

___
Python tracker 

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



[issue44080] Bias in random.choices(long_sequence)

2021-05-09 Thread Mark Dickinson


Mark Dickinson  added the comment:

This is similar to #9025 (for randrange), and in principle the random.choices 
case without explicit weights could be fixed similarly. But I'm not sure it's 
worth it, for a couple of reasons:

- The problem only really affects "virtual" population sequences like 
``range``, where the actual population isn't realised in memory. For 
populations in list form, in practice the population size will be limited to a 
few billion, and I think you'd be hard pushed to demonstrate statistically 
detectable bias at that size. (That is, my claim is that it would be 
essentially impossible to distinguish the existing "random.choices" 
implementation from a "fixed" unbiased version based on inputs and outputs 
alone.)

- The speed of random.choices is a particular selling point - we don't have 
anything else in the random module that lets you generate millions of variates 
at once. I'd expect replacing `floor(random() * n)` with `self._randbelow(n)` 
to cause a significant speed regression.

- For explicit weights, there isn't a practical route to handling those that 
doesn't involve use of floating-point in general, so for those we have to 
accept some tiny bias anyway. (Yes, we could technically do something unbiased 
for the case of integer-only weights, but that seems like significant work for 
a special case that I'd expect just doesn't matter that much in practice.) And 
again in this case, the weights list will usually be a "real" list, so we're 
again limited to populations of a few billion and it'll be hard to demonstrate 
statistically detectable bias.

@Dennis: for interests sake, do you have bandwidth to do some timings of the 
current "[population[floor(random() * n)] for i in _repeat(None, k)]" versus 
something like "[population[_randbelow(n)] for i in _repeat(None, k)]" (after 
putting "_randbelow = self._randbelow" to save an attribute lookup on each 
iteration)?

--

___
Python tracker 

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



[issue44076] issue with list in Python 3.8.5

2021-05-09 Thread Mohamed


Mohamed  added the comment:

I tried the following method:

class MasterApp(object):
def __init__(self, root):


def fun_astinfo_add(self):
...
assetinfo_lst.append(lst_values)
...
MasterApp(root)

...
if __name__ == "__main__":
root = Tk()
App = MasterApp(root)
root.mainloop()

The program works properly, but the screen disappears and then reappears. Which 
means, that mainloop() works in the first time,
and when there is any change in the data, it does not work.

Reinstalling Tkinter is the right solution? Will it work?

--

___
Python tracker 

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



[issue44087] [sqlite3] consider adding Py_TPFLAGS_DISALLOW_INSTANTIATION to sqlite3.Statement

2021-05-09 Thread Erlend E. Aasland


New submission from Erlend E. Aasland :

Currently, the sqlite3.Statement type is not exposed in the module dict:

>>> import sqlite3
>>> sqlite3.Statement
Traceback (most recent call last):
  File "", line 1, in 
  File 
"/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/sqlite3/__init__.py",
 line 37, in __getattr__
raise AttributeError(f"module 'sqlite3' has no attribute '{name}'")
AttributeError: module 'sqlite3' has no attribute 'Statement'


It is possible to extract it using this trick:
>>> cx = sqlite3.connect(":memory:")
>>> stmt = cx("select 1")
>>> type(stmt)

>>> type(stmt)()


There is no use case for this; statement objects belong to the internal 
workings of the sqlite3 module. I suggest adding 
Py_TPFLAGS_DISALLOW_INSTANTIATION to make this fact more explicit.

--
keywords: easy (C)
messages: 393310
nosy: berker.peksag, erlendaasland, serhiy.storchaka
priority: normal
severity: normal
status: open
title: [sqlite3] consider adding Py_TPFLAGS_DISALLOW_INSTANTIATION to 
sqlite3.Statement
type: enhancement

___
Python tracker 

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



[issue22956] Improved support for prepared SQL statements

2021-05-09 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
nosy: +corona10

___
Python tracker 

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



[issue22956] Improved support for prepared SQL statements

2021-05-09 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
nosy: +berker.peksag

___
Python tracker 

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



[issue22956] Improved support for prepared SQL statements

2021-05-09 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

As Gerhard said in msg233384, there is already a statement cache. 
sqlite3_prepare_v2() is only called if the statement is not found in the cache.

Current behaviour:
>>> import sqlite3
>>> cx = sqlite3.connect(":memory:")
>>> cu = cx.cursor()
>>> cu.execute("select 1")  # sqlite3_prepare_v2() called
>>> cu.execute("select 1")  # sqlite3_prepare_v2() is _not_ called


Suggesting to close this issue.

--
nosy: +erlendaasland

___
Python tracker 

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



[issue39228] traceback.FrameSummary does not handle exceptions from `repr()`

2021-05-09 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
nosy:  -terry.reedy
versions: +Python 3.11 -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



[issue44086] py.svg not found on search result page

2021-05-09 Thread Jürgen Gmach

New submission from Jürgen Gmach :

repro: 
- go to docs (Python 3.11)
- open dev console in browser
- search for e.g ."xml rpc"
-> 404 py.svg not found


or open dev console and got to this URL directly:
https://docs.python.org/3.11/search.html?q=xml+rpc

P.S.: No 404 for the docs on 3.10

--
assignee: docs@python
components: Documentation
files: Screenshot from 2021-05-09 10-04-17.png
messages: 393308
nosy: docs@python, jugmac00
priority: normal
severity: normal
status: open
title: py.svg not found on search result page
versions: Python 3.11
Added file: https://bugs.python.org/file50027/Screenshot from 2021-05-09 
10-04-17.png

___
Python tracker 

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



[issue44083] problem with updated 3.9.5

2021-05-09 Thread Shreyan Avigyan


Shreyan Avigyan  added the comment:

What is the input are you expecting? int can only convert string with only 
numbers like "10" or "2" not "10 abc" or "2 abc".

--
nosy: +shreyanavigyan

___
Python tracker 

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



[issue44085] Remaining invalid rules in simplified grammar

2021-05-09 Thread Pierre Quentel


New submission from Pierre Quentel :

In the simplified version of Python grammar at 
https://docs.python.org/3.10/reference/grammar.html, most 'invalid_' from 
the complete grammar at 
https://github.com/python/cpython/blob/3.10/Grammar/python.gram have been 
removed, but 2 of them remain :

primary:
| invalid_primary  # must be before 'primay genexp' because of 
invalid_genexp

dict:
| '{' invalid_double_starred_kvpairs '}'

I suppose that the simplified version is extracted from the complete grammar 
with a program, and this program doesn't detect the 'invalid_' that don't 
end the line, since these 2 occurrences correspond to the only such lines in 
the complete grammar

primary[expr_ty]:
| invalid_primary  # must be before 'primay genexp' because of 
invalid_genexp

dict[expr_ty]:
| '{' invalid_double_starred_kvpairs '}'

Also note the typo in the comment : 'primay genexp' instead of 'primary genexp'

--
assignee: docs@python
components: Documentation
messages: 393306
nosy: docs@python, quentel
priority: normal
severity: normal
status: open
title: Remaining invalid rules in simplified grammar
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



[issue41730] Show deprecation warnings for tkinter.tix

2021-05-09 Thread miss-islington


miss-islington  added the comment:


New changeset c3eb3c18f1472b739db486c99f7f2125c4809680 by Miss Islington (bot) 
in branch '3.10':
Revert test for Tix deprecation warning (GH-26005)
https://github.com/python/cpython/commit/c3eb3c18f1472b739db486c99f7f2125c4809680


--

___
Python tracker 

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



[issue44083] problem with updated 3.9.5

2021-05-09 Thread Eric V. Smith


Eric V. Smith  added the comment:

Also: How are you executing this code? From IDLE? From the command line?

--
status: pending -> open

___
Python tracker 

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



[issue44083] problem with updated 3.9.5

2021-05-09 Thread Eric V. Smith


Eric V. Smith  added the comment:

This is almost certainly not a bug in python. You're probably entering an empty 
string for "a".

Try it without using input(). For example, replace lines 2 and 3 with:
a = "3"
b = "4"

--
nosy: +eric.smith
status: open -> pending

___
Python tracker 

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



[issue41730] Show deprecation warnings for tkinter.tix

2021-05-09 Thread Zachary Ware


Zachary Ware  added the comment:

Fixed in GH-26005 and GH-26006, which just revert the test.

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



[issue44080] Bias in random.choices(long_sequence)

2021-05-09 Thread Mark Dickinson


Change by Mark Dickinson :


--
nosy: +mark.dickinson

___
Python tracker 

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



[issue41730] Show deprecation warnings for tkinter.tix

2021-05-09 Thread miss-islington


Change by miss-islington :


--
pull_requests: +24658
pull_request: https://github.com/python/cpython/pull/26006

___
Python tracker 

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



[issue44084] Can't mark match, case, _ as keywords in docs

2021-05-09 Thread Tal Einat


New submission from Tal Einat :

Beginning in Python 3.10, `match`, `case` and `_` are "soft keywords", i.e. 
they are considered keywords only in specific parts of the syntax.

However, they cannot be tagged with a :keyword:`...` role in our docs.

This appears to be due to not appearing in the list of keywords in the Python 
lexer in Pygments, which is used by Sphinx.

I've opened an issue on the Pygments repo about this:
https://github.com/pygments/pygments/issues/1797

--
assignee: docs@python
components: Documentation
messages: 393301
nosy: docs@python, taleinat
priority: normal
severity: normal
status: open
title: Can't mark match, case, _ as keywords in docs
type: behavior
versions: Python 3.10, Python 3.11

___
Python tracker 

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



[issue41930] Wrap sqlite3_serialize API in sqlite3 module

2021-05-09 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

What would be the use case for this?

--
nosy: +erlendaasland

___
Python tracker 

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



[issue41730] Show deprecation warnings for tkinter.tix

2021-05-09 Thread Zachary Ware


Change by Zachary Ware :


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

___
Python tracker 

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



[issue44083] problem with updated 3.9.5

2021-05-09 Thread Swarnila Chakma


New submission from Swarnila Chakma :

the codes were running okay with the version 3.9.4. But yesterday after 
updating the new version 3.9.5, the same codes are showing error. For example, 
if I were to write a code about swapping numbers, i write the code:

print('Enter two variables')
a = input() #suppose 2 nilam
b = input()#suppose 3 nilam
x = int(a)
y = int(b)
x = x-y #now we stored value of x-y in x variable
y = x+y #now we stored value of x+y in y variable
x = y-x
print(x)
print(y)

And I get the following output:

File "C:/Users/Asus/PycharmProjects/celsius to fahrenheit/main.py", line 4, in 

x = int(a)
ValueError: invalid literal for int() with base 10: ''

I tried reinstalling the version 3.9.4, but it's the same result. It would be 
appreciable if it can be solved soon.

--
components: Windows
files: main.py
messages: 393299
nosy: paul.moore, steve.dower, swarnila707, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: problem with updated 3.9.5
versions: Python 3.9
Added file: https://bugs.python.org/file50026/main.py

___
Python tracker 

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