[issue45862] Anomaly of eval() of list comprehension

2021-11-21 Thread David Pratten


New submission from David Pratten :

Hi

Example "eg def2" works but "eg def4" gives an error?

David

```
emp = [
{
"empno": 7839,
"mgr": 0,
"ename": "KING"
},
{
"empno": 7566,
"mgr": 7839,
"ename": "JONES"
},
{
"empno": 7698,
"mgr": 7839,
"ename": "BLAKE"
}
]

a = [e for e in emp if e["mgr"] == 0]
print('eg 1', [b for b in a])
print('eg 2', eval('[b for b in a]'))
print('eg 3', [e for e in emp for b in a if e["mgr"] == b["empno"]])
print('eg 4', eval('[e for e in emp for b in a if e["mgr"] == b["empno"]]'))


def eval_anomaly():
a_anomaly = [e for e in emp if e["mgr"] == 0]
print('eg def1', [b for b in a_anomaly])
print('eg def2', eval('[b for b in a_anomaly]'))
print('eg def3', [e for e in emp for b in a_anomaly if e["mgr"] == 
b["empno"]])
print('eg def4', eval('[e for e in emp for b in a_anomaly if e["mgr"] == 
b["empno"]]'))

eval_anomaly()
```

--
messages: 406743
nosy: david2
priority: normal
severity: normal
status: open
title: Anomaly of eval() of list comprehension
type: behavior
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



[issue45858] Deprecate default converters in sqlite3

2021-11-21 Thread Kevin


Change by Kevin :


--
nosy: +Strongbeard

___
Python tracker 

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



[issue45861] Can't find a usable init.tcl

2021-11-21 Thread heheoa


heheoa  added the comment:

i just needed to install tcl

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



[issue45861] Can't find a usable init.tcl

2021-11-21 Thread heheoa


New submission from heheoa :

_tkinter.TclError: Can't find a usable init.tcl in the following directories: 
/usr/lib/tcl8.6 /usr/lib/tcl8.6 /lib/tcl8.6 /usr/library /library 
/tcl8.6.12/library /tcl8.6.12/library

--
components: Tkinter
messages: 406741
nosy: nobodyatall
priority: normal
severity: normal
status: open
title: Can't find a usable init.tcl
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



Re: Unexpected behaviour of math.floor, round and int functions (rounding)

2021-11-21 Thread Greg Ewing

On 22/11/21 4:58 am, Grant Edwards wrote:

Yep, IIRC, it was a 4 bit processor because 4 bits is what it takes to
represent one decimal digit.


That was the Saturn, first used in the HP-71B. The original
architecture (known as the "Nut")was weirder than that. It operated
serially on 56 bit words (14 BCD digits), and the instructions
had options for operating on various fields of a floating-point
number (mantissa, exponent, sign, etc.)

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


[issue45860] UnboundLocalError leads to Illegal instruction crashing CPython

2021-11-21 Thread Xinmeng Xia


New submission from Xinmeng Xia :

The following code can lead to a crash and report Illegal instruction (core 
dumped)(few times) or Trace/breakpoint trap (core dumped) (very few times) or 
Segmentation fault (core dumped) (most times) on Python 3.11. 

test_free_different_thread.py

import inspect
import sys
import threading
import unittest
import weakref
import ctypes
from test.support import run_doctest, run_unittest, cpython_only, 
check_impl_detail
import _testcapi
from types import FunctionType
from test import test_code
import test_code

def test_free_different_thread():
f = CoExtra.get_func()

class ThreadTest(threading.Thread):

def __init__(CoExtra, f, test):
super().__init__()
CoExtra.f = CoExtra
CoExtra.test = test

def run(CoExtra):
del CoExtra.f
CoExtra.test.assertEqual(test_code.LAST_FREED, 500)
test_code.SetExtra(f.__code__, test_code.FREE_INDEX, ctypes.c_voidp(500))
f = ThreadTest(CoExtra, f)
del tt
tt.start()
tt.join()
CoExtra.assertEqual(test_code.LAST_FREED, 500)

CoExtra = test_code.CoExtra()
test_free_different_thread()
=

-
Traceback (most recent call last):
  File "/home/xxm/Desktop/test_free_different_thread.py", line 33, in 
test_free_different_thread()

  File "/home/xxm/Desktop/test_free_different_thread.py", line 28, in 
test_free_different_thread
del tt
^^
UnboundLocalError: cannot access local variable 'tt' where it is not associated 
with a value
Illegal instruction (core dumped)/Trace/breakpoint trap (core 
dumped)/Segmentation fault (core dumped)


Version: python 3.9, python 3.10, python 3.11 on ubuntu 16.04

Reproduce step:
1.download test_code.py and place test_free_different_thread.py and test_code 
in a same directory.
2. run with "python test_free_different_thread.py"

The test_code.py is from cpython' test. We can also annotate "import test_code" 
and run test_free_different_thread.py directly. But it seems that Illegal 
instruction and Trace/breakpoint trap cannot be reproduced.

--
components: Interpreter Core
files: test_code.py
messages: 406740
nosy: xxm
priority: normal
severity: normal
status: open
title: UnboundLocalError leads to Illegal instruction crashing CPython
type: crash
versions: Python 3.11
Added file: https://bugs.python.org/file50455/test_code.py

___
Python tracker 

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



[issue44649] dataclasses slots with init=False field raises AttributeException

2021-11-21 Thread Eric V. Smith


Change by Eric V. Smith :


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



[issue44649] dataclasses slots with init=False field raises AttributeException

2021-11-21 Thread Eric V. Smith


Change by Eric V. Smith :


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

___
Python tracker 

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



[issue45859] test_collections has a wrong test in case _itemgetter is not available

2021-11-21 Thread Raymond Hettinger


Change by Raymond Hettinger :


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



Re: doubt About import machine

2021-11-21 Thread Joe Pfeiffer
Daniel Eduardo Almeida Correa  writes:

> Hello, I'm trying to use the machine library in python 3.10 version, but I
> can't import it with the pip install machine, could you tell me a way to
> solve it  or a python version compatible with the library? Thank you a lot
> for your answer.

The "machine" package on pypi appears to only be an example of best
practices for a python package, and doesn't actually contain anything
useful.  Installing it doesn't actually give you a package called
"machine" that you can import; it lets you import something called
"sample" instead, which contains

def main():
"""Entry point for the application script"""
print("Call your main application code here")

as its __init__()

I'll note that I'm sort of a beginner with python so I may be speaking
out of turn, but it strikes me as really unlikely that the "best
practice" for a package named "machine" would put its code in a
directory named "sample".

Following the home page link for the project leads to a 404 on github
-- 
https://mail.python.org/mailman/listinfo/python-list


[Python-announce] PyCA cryptography 36.0.0 released

2021-11-21 Thread Paul Kehrer
PyCA cryptography 36.0.0 has been released to PyPI. cryptography
includes both high level recipes and low level interfaces to common
cryptographic algorithms such as symmetric ciphers, asymmetric
algorithms, message digests, X509, key derivation functions, and much
more. We support Python 3.6+, and PyPy3.

(As a reminder, cryptography changed its versioning scheme with 35.0.
For more information see
https://cryptography.io/en/latest/api-stability/#versioning)

Changelog (https://cryptography.io/en/latest/changelog/#v36-0-0):
* FINAL DEPRECATION: Support for verifier and signer on our asymmetric
key classes was deprecated in version 2.1. These functions had an
extended deprecation due to usage, however the next version of
cryptography will drop support. Users should migrate to sign and
verify.
* The entire X.509 layer is now written in Rust. This allows alternate
asymmetric key implementations that can support cloud key management
services or hardware security modules provided they implement the
necessary interface (for example: EllipticCurvePrivateKey).
* Deprecated the backend argument for all functions.
* Added support for AESOCB3.
* Added support for iterating over arbitrary request attributes.
* Deprecated the get_attribute_for_oid method on
CertificateSigningRequest in favor of get_attribute_for_oid() on the
new Attributes object.
* Fixed handling of PEM files to allow loading when certificate and
key are in the same file.
* Fixed parsing of CertificatePolicies extensions containing legacy
BMPString values in their explicitText.
* Allow parsing of negative serial numbers in certificates. Negative
serial numbers are prohibited by RFC 5280 so a deprecation warning
will be raised whenever they are encountered. A future version of
cryptography will drop support for parsing them.
* Added support for parsing PKCS12 files with friendly names for all
certificates with load_pkcs12(), which will return an object of type
PKCS12KeyAndCertificates.
rfc4514_string() and related methods now have an optional
attr_name_overrides parameter to supply custom OID to name mappings,
which can be used to match vendor-specific extensions.
* BACKWARDS INCOMPATIBLE: Reverted the nonstandard formatting of email
address fields as E in rfc4514_string() methods from version 35.0. The
previous behavior can be restored with:
name.rfc4514_string({NameOID.EMAIL_ADDRESS: "E"})
* Allow X25519PublicKey and X448PublicKey to be used as public keys
when parsing certificates or creating them with CertificateBuilder.
These key types must be signed with a different signing algorithm as
X25519 and X448 do not support signing.
* Extension values can now be serialized to a DER byte string by
calling public_bytes().
* Added experimental support for compiling against BoringSSL. As
BoringSSL does not commit to a stable API, cryptography tests against
the latest commit only. Please note that several features are not
available when building against BoringSSL.
* Parsing CertificateSigningRequest from DER and PEM now, for a
limited time period, allows the Extension critical field to be
incorrectly encoded. See the issue for complete details. This will be
reverted in a future cryptography release.
* When OCSPNonce are parsed and generated their value is now correctly
wrapped in an ASN.1 OCTET STRING. This conforms to RFC 6960 but
conflicts with the original behavior specified in RFC 2560. For a
temporary period for backwards compatibility, we will also parse
values that are encoded as specified in RFC 2560 but this behavior
will be removed in a future release.

-Paul Kehrer (reaperhulk)
___
Python-announce-list mailing list -- python-announce-list@python.org
To unsubscribe send an email to python-announce-list-le...@python.org
https://mail.python.org/mailman3/lists/python-announce-list.python.org/
Member address: arch...@mail-archive.com


[issue42268] ./configure failing when --with-memory-sanitizer specified

2021-11-21 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

Reproducible on 3.9, 3.10, and on main.

The --with-memory-sanitizer option adds "-fsanitize=memory 
-fsanitize-memory-track-origins=2 -fno-omit-frame-pointer" to CFLAGS, and 
"-fsanitize=memory -fsanitize-memory-track-origins=2" to LDFLAGS. The 
MemorySanitizer is a clang specific feature, AFAIK. You're using GCC, so what 
happens is that these (GCC incompatible) flags are added and the following 
compile check (getaddrinfo) fails.


IMO, adding a compiler check and printing a warning if --with-memory-sanitizer 
is used with GCC should be an ok solution. Alternatively, we inform the user 
that we're switching to using the leak sanitiser, if we're on GCC.


+pablo

See also:
  - https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html
  - https://clang.llvm.org/docs/MemorySanitizer.html

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



[issue42268] ./configure failing when --with-memory-sanitizer specified

2021-11-21 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
nosy: +pablogsal

___
Python tracker 

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



[issue45859] test_collections has a wrong test in case _itemgetter is not available

2021-11-21 Thread Carl Friedrich Bolz-Tereick


Change by Carl Friedrich Bolz-Tereick :


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

___
Python tracker 

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



[issue45859] test_collections has a wrong test in case _itemgetter is not available

2021-11-21 Thread Carl Friedrich Bolz-Tereick


New submission from Carl Friedrich Bolz-Tereick :

test_field_descriptor in test_collections tries to pickle the descriptors of a 
namedtuple's fields, which is _collections._itemgetter on CPython. However, on 
PyPy that class doesn't exist. The code in collections deals fine with that 
fact, but the above-mentioned test does not make sense in that situation, since 
you can't pickle properties.

To test this behaviour, you can replace
"from _collections import _tuplegetter"
in collections/__init__.py with raise ImportError and see the test fail on 
CPython too.

--
messages: 406738
nosy: Carl.Friedrich.Bolz
priority: normal
severity: normal
status: open
title: test_collections has a wrong test in case _itemgetter is not available
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



Re: doubt About import machine

2021-11-21 Thread MRAB

On 2021-11-21 18:36, Daniel Eduardo Almeida Correa wrote:

Hello, I'm trying to use the machine library in python 3.10 version, but I
can't import it with the pip install machine, could you tell me a way to
solve it  or a python version compatible with the library? Thank you a lot
for your answer.

Are you talking about the "machine" module of MicroPython? I believe 
that's specific to MicroPython.

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


[issue45813] Importing asyncio after deleting a coroutine object and before cleaning it up leads to crashing on Python3.11

2021-11-21 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

Even without garbage-collecting the coroutine, we get a failed assertion in 
debug mode (but no crash with the assertion removed):

Python 3.11.0a2+ (heads/main:c8c21bdd19, Nov 21 2021, 13:58:01) [MSC v.1929 64 
bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> async def f():
... pass
...
>>> coro = f()
>>> frame = coro.cr_frame
>>> frame.clear()
:1: RuntimeWarning: coroutine 'f' was never awaited
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
Assertion failed: f->f_frame->generator == NULL, file 
C:\Users\sween\Source\Repos\cpython2\cpython\Objects\frameobject.c, line 705

--

___
Python tracker 

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



[issue45813] Importing asyncio after deleting a coroutine object and before cleaning it up leads to crashing on Python3.11

2021-11-21 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

I think the import is irrelevant (luckily). This still crashes:

async def f():
pass
frame = f().cr_frame
frame.clear()

--

___
Python tracker 

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



[issue45813] Importing asyncio after deleting a coroutine object and before cleaning it up leads to crashing on Python3.11

2021-11-21 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

I got a crash on Windows in Objects/genobject.c:

void
_PyGen_Finalize(PyObject *self)
{
PyGenObject *gen = (PyGenObject *)self;
PyObject *res = NULL;
PyObject *error_type, *error_value, *error_traceback;

if (gen->gi_xframe == NULL ||  _PyFrameHasCompleted(gen->gi_xframe)) { 
<--- Crash is here
/* Generator isn't paused, so no need to close */
return;
}
...


It looks like gen->gi_xframe is a junk-but-not-NULL pointer that is getting 
dereferenced by _PyFrameHasCompleted.

Maybe related to bpo-44590.

--
nosy: +Dennis Sweeney, Mark.Shannon

___
Python tracker 

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



Re: get_axes not present?

2021-11-21 Thread Mahmood Naderan via Python-list

>Your example isn't minimal enough for me to be able to pin it down any
>better than that, though.

Chris,
I was able to simply it even further. Please look at this:


$ cat test.batch.csv
Value,Value
10,2
5,2
10,2


$ cat test.py
import pandas as pd
import csv,sys
import matplotlib
import matplotlib.pyplot as plt

df = pd.read_csv('test.batch.csv')
print(df)

def plot_dataframe(df, cnt, axes):
    df.columns = range(1, len(df.columns)+1)   # Ignore the column header
    row = df.iloc[0].astype(int)  # First row in the dataframe
    plt.subplot(2, 1, 1)
    print("axes=", axes)
    print("axes[0]=", axes[0])
    print("cnt=", cnt)
    print("row=", row)
    ax1 = row.plot(label=cnt, ax=axes[0], marker='o')   # Line chart
    ax1.set_ylabel( 'test', fontsize=15 )
    plt.subplot(2, 1, 2)
    df2 = row.value_counts()
    df2.reindex().plot(kind='bar', label=cnt, ax=axes[1])   # Histogram

def plot_kernels(df):
    fig,axes = plt.subplots(2,1, figsize=(20, 15))
    cnt=1
    plot_dataframe(df, cnt, axes)
    cnt = cnt + 1
    for ax in axes:
    ax.legend()
    plt.show()

print("matplotlib version = ",  matplotlib.__version__)
print("pandas version = ", pd.__version__)
print("sys version", sys.version_info)

plot_kernels(df)




And the output is


$ python3 test.py
   Value  Value.1
0 10    2
1  5    2
2 10    2
matplotlib version =  3.3.4
pandas version =  1.2.3
sys version sys.version_info(major=3, minor=8, micro=10, releaselevel='final', 
serial=0)
axes= [ ]
axes[0]= AxesSubplot(0.125,0.53;0.775x0.35)
cnt= 1
row= 1    10
2 2
Name: 0, dtype: int64
Traceback (most recent call last):
  File "test.py", line 41, in 
    plot_kernels(df)
  File "test.py", line 29, in plot_kernels
    plot_dataframe(df, cnt, axes)
  File "test.py", line 19, in plot_dataframe
    ax1 = row.plot(label=cnt, ax=axes[0], marker='o')   # Line chart
  File 
"/home/mnaderan/.local/lib/python3.8/site-packages/pandas/plotting/_core.py", 
line 955, in __call__
    return plot_backend.plot(data, kind=kind, **kwargs)
  File 
"/home/mnaderan/.local/lib/python3.8/site-packages/pandas/plotting/_matplotlib/__init__.py",
 line 61, in plot
    plot_obj.generate()
  File 
"/home/mnaderan/.local/lib/python3.8/site-packages/pandas/plotting/_matplotlib/core.py",
 line 283, in generate
    self._adorn_subplots()
  File 
"/home/mnaderan/.local/lib/python3.8/site-packages/pandas/plotting/_matplotlib/core.py",
 line 483, in _adorn_subplots
    all_axes = self._get_subplots()
  File 
"/home/mnaderan/.local/lib/python3.8/site-packages/pandas/plotting/_matplotlib/core.py",
 line 903, in _get_subplots
    ax for ax in self.axes[0].get_figure().get_axes() if isinstance(ax, Subplot)
AttributeError: 'NoneType' object has no attribute 'get_axes'



Any idea about that?



Regards,
Mahmood

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


Re: get_axes not present?

2021-11-21 Thread Mahmood Naderan via Python-list
>I installed the latest pandas, although on Python 3.10, and the script
>worked without a problem.


Yes as I wrote it works with 1.3.3 but mine is 1.2.3.
I am trying to keep the current version because of the possible future 
consequences. In the end maybe I have to upgrade the pandas.


Regards,
Mahmood



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


Re: Unexpected behaviour of math.floor, round and int functions (rounding)

2021-11-21 Thread Peter J. Holzer
On 2021-11-22 05:43:48 +1100, Chris Angelico wrote:
> On Mon, Nov 22, 2021 at 5:42 AM Peter J. Holzer  wrote:
> > (I think I used Math::BigRat in Perl, but I've been
> > programming in Perl for a lot longer.)
> 
> Rodents Of Unusual Size? I don't think they exist...

https://www.girlgeniusonline.com/comic.php?date=20210614 ;-)

hp

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


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


Re: Unexpected behaviour of math.floor, round and int functions (rounding)

2021-11-21 Thread Peter J. Holzer
On 2021-11-21 10:57:55 +1100, Chris Angelico wrote:
> And if decimal floating point were common, other "surprise" behaviour
> would be cited, like how x < y and (x+y)/2 < x.

Yup. Took me a bit to find an example, but this can happen. My HP-48
calculator uses a mantissa of 12 decimal digits.

 + 6667 = 13330
13330 / 2 = 6665

6665 < . QED.

hp


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


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


Re: frozenset can be altered by |=

2021-11-21 Thread Jach Feng
Marco Sulla 在 2021年11月20日 星期六上午5:12:19 [UTC+8] 的信中寫道:
> (venv_3_10) marco@buzz:~$ python 
> Python 3.10.0 (heads/3.10-dirty:f6e8b80d20, Nov 18 2021, 19:16:18) 
> [GCC 10.1.1 20200718] on linux 
> Type "help", "copyright", "credits" or "license" for more information. 
> >>> a = frozenset((3, 4)) 
> >>> a 
> frozenset({3, 4}) 
> >>> a |= {5,} 
> >>> a 
> frozenset({3, 4, 5})
There is no CONSTANT in Pyhton as other languages does. The only way to have it 
is using special naming convention, such as in all capital letters, to remind 
yourself not to re-assign it:-)

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


doubt About import machine

2021-11-21 Thread Daniel Eduardo Almeida Correa
Hello, I'm trying to use the machine library in python 3.10 version, but I
can't import it with the pip install machine, could you tell me a way to
solve it  or a python version compatible with the library? Thank you a lot
for your answer.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue45858] Deprecate default converters in sqlite3

2021-11-21 Thread Ethan Furman


Change by Ethan Furman :


--
nosy: +ethan.furman

___
Python tracker 

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



[issue26651] Deprecate register_adapter() and register_converter() in sqlite3

2021-11-21 Thread Ethan Furman


Change by Ethan Furman :


--
nosy: +ethan.furman

___
Python tracker 

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



Re: Unexpected behaviour of math.floor, round and int functions (rounding)

2021-11-21 Thread Chris Angelico
On Mon, Nov 22, 2021 at 5:42 AM Peter J. Holzer  wrote:
> (I think I used Math::BigRat in Perl, but I've been
> programming in Perl for a lot longer.)
>

Rodents Of Unusual Size? I don't think they exist...

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


Re: Unexpected behaviour of math.floor, round and int functions (rounding)

2021-11-21 Thread Peter J. Holzer
On 2021-11-20 03:25:53 +, Ben Bacarisse wrote:
> Chris Angelico  writes:
> 
> > It does mean exactly what it meant in grade school, just as 1/3 means
> > exactly what it meant in grade school. Now try to represent 1/3 on a
> > blackboard, as a decimal fraction. If that's impossible, does it mean
> > that 1/3 doesn't mean 1/3, or that 1/3 can't be represented?
> 
> As you know, it is possible, but let's say we outlaw any finite notation
> for repeated digits...  Why should I convert 1/3 to this particular
> apparently unsuitable representation?

Because you want to use tools which require that particular
representation? Like for example a pocket calculator?

> I will write 1/3 and manipulate that number using factional notation.

On paper, maybe. But if after a few more steps you have fractions like
37645 / 9537654, you might reconsider that choice.

In a program? Yes, there are cases where you really want to use
fractions. That's why fractions.Fraction exists in Python (and similar
datatypes in many other programming languages). But they have their
limits, too (no π or √2) and for most problems you don't need them. I
don't actually think I ever used fractions.Fraction in my 7 years of
Python programming. (I think I used Math::BigRat in Perl, but I've been
programming in Perl for a lot longer.)

hp

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


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


Re: Unexpected behaviour of math.floor, round and int functions (rounding)

2021-11-21 Thread Peter J. Holzer
On 2021-11-19 12:43:07 +0100, ast wrote:
> Le 19/11/2021 à 03:51, MRAB a écrit :
> > On 2021-11-19 02:40, 2qdxy4rzwzuui...@potatochowder.com wrote:
> > > On 2021-11-18 at 23:16:32 -0300,
> > > René Silva Valdés  wrote:
> > > > Hello, I would like to report the following issue:
> > > > 
> > > > Working with floats i noticed that:
> > > > 
> > > > int(23.99/12) returns 1, and
> > > > int(23.999/12) returns 2
> > > > 
> > > > This implies that int() function is rounding ...
[...]
> > Python 3.10.0 (tags/v3.10.0:b494f59, Oct  4 2021, 19:00:18) [MSC v.1929
> > 64 bit (AMD64)] on win32
> > Type "help", "copyright", "credits" or "license" for more information.
> >  >>> 23.99 == 24
> > False
> >  >>> 23.999 == 24
> > True
> 
> >>> 0.3 + 0.3 + 0.3 == 0.9
> False

Fascinating. The OP ran into the fact that FP numbers have a limited
number of digits in the mantissa (completely independent of the base).
Someone else mentions 0.3 and everybody takes off on that tangent.

hp

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


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


Re: Advantages of Default Factory in Dataclasses

2021-11-21 Thread Paul Bryan
On Sun, 2021-11-21 at 21:51 +0400, Abdur-Rahmaan Janhangeer wrote:
> 
> On Tue, Nov 16, 2021 at 7:17 PM Paul Bryan  wrote:
> > On Tue, 2021-11-16 at 17:04 +0400, Abdur-Rahmaan Janhangeer wrote:
> > 
> > > A simple question: why do we need field(default_factory ) in
> > > dataclasses?
> > 
> > 
> > To initialize a default value when a new instance of the dataclass
> > is created. For example, if you want a field to default to a dict.
> > A new dict is created for each instance of the dataclass created.
> > 
> 
> 
> Why not have an attribute which returns a deep copy of a dict?

You can certainly write a default factory to return a deep copy. I'm
not understanding your question about the attribute though. Attribute
in what object? What might the code look like using an attribute?

> Like the only advantage of default factory is copying whatever we
> specify? 

The advantage of the default factory is that it can generate a value at
the time a data class is initialized.

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


[issue33558] Python has no icon in taskbar and in start screen

2021-11-21 Thread Irit Katriel


Irit Katriel  added the comment:

3.6 is no longer maintained. Please create a new issue if you are having this 
problem with a current version of python (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



[issue33158] Add fileobj property to csv reader and writer objects

2021-11-21 Thread Irit Katriel


Change by Irit Katriel :


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

___
Python tracker 

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



Re: Advantages of Default Factory in Dataclasses

2021-11-21 Thread Abdur-Rahmaan Janhangeer
On Tue, Nov 16, 2021 at 7:17 PM Paul Bryan  wrote:

> On Tue, 2021-11-16 at 17:04 +0400, Abdur-Rahmaan Janhangeer wrote:
>
> A simple question: why do we need field(default_factory ) in dataclasses?
>
>
> To initialize a default value when a new instance of the dataclass is
> created. For example, if you want a field to default to a dict. A new dict
> is created for each instance of the dataclass created.
>


Why not have an attribute which returns a deep copy of a dict?

Like the only advantage of default factory is copying whatever we specify?
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue23952] cgi: Document the 'maxlen' member of the cgi module

2021-11-21 Thread Irit Katriel


Change by Irit Katriel :


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

___
Python tracker 

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



[issue23952] cgi: Document the 'maxlen' member of the cgi module

2021-11-21 Thread Irit Katriel


Irit Katriel  added the comment:

I

--
components: +Library (Lib)
keywords: +easy, newcomer friendly
nosy: +iritkatriel
type:  -> enhancement
versions: +Python 3.11 -Python 3.7, Python 3.8

___
Python tracker 

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



Re: get_axes not present?

2021-11-21 Thread MRAB

On 2021-11-21 16:39, Mahmood Naderan via Python-list wrote:

The best way to get
assistance here on the list is to create a minimal, self-contained,
run-able, example program that you can post in its entirety here that
demonstrates the issue.



I created a sample code with input. Since the code processes a csv file to 
group input rows, I also included those in this minimal code but those 
preprocesses are not buggy. In this sample code, I used print() to print 
necessary information. The error exists in the plot function. I tested the 
dictionary build before that and it is fine.


Code is available at https://pastebin.com/giAnjJDV  and the input file 
(test.batch.csv) is available https://pastebin.com/Hdp4Wt9B

The run command is "python3 test.py". With the versions specified in my system, 
here is the full output:





$ python3 test.py
Reading file...
matplotlib version =  3.3.4
pandas version =  1.2.3
sys version sys.version_info(major=3, minor=8, micro=10, releaselevel='final', 
serial=0)
Original dictionary =  {'dummy': Value
M1  0
M2  0
M3  0, 'K1::foo(bar::z(x,u))':    Value  Value
0 10  2
1  5  2
2 10  2, 'K2::foo()':    Value
0 20
1 10
2 15, 'K3::foo(baar::y(z,u))':    Value
0 12
1 13
2 14, 'K3::foo(bar::y(z,u))':    Value
0  6
1  7
2  8}
New dictionary for plot =  {'dummy': Value
M1  0
M2  0
M3  0, 'K1::foo(bar::z(x,u))':    Value  Value
0 10  2
1  5  2
2 10  2, 'K3::foo(bar::y(z,u))':    Value
0  6
1  7
2  8}
Key is  K1::foo(bar::z(x,u))  -> df is Value  Value
0 10  2
1  5  2
2 10  2
axes= [ ]
axes[0]= AxesSubplot(0.125,0.53;0.775x0.35)
cnt= 1
row= 1    10
2 2
Name: 0, dtype: int64
Traceback (most recent call last):
   File "test.py", line 74, in 
     plot_kernels(my_dict2)
   File "test.py", line 52, in plot_kernels
     plot_dataframe(df, cnt, axes)
   File "test.py", line 36, in plot_dataframe
     ax1 = row.plot(label=cnt, ax=axes[0], marker='o')   # Line chart
   File 
"/home/mahmood/.local/lib/python3.8/site-packages/pandas/plotting/_core.py", 
line 955, in __call__
     return plot_backend.plot(data, kind=kind, **kwargs)
   File 
"/home/mahmood/.local/lib/python3.8/site-packages/pandas/plotting/_matplotlib/__init__.py",
 line 61, in plot
     plot_obj.generate()
   File 
"/home/mahmood/.local/lib/python3.8/site-packages/pandas/plotting/_matplotlib/core.py",
 line 283, in generate
     self._adorn_subplots()
   File 
"/home/mahmood/.local/lib/python3.8/site-packages/pandas/plotting/_matplotlib/core.py",
 line 483, in _adorn_subplots
     all_axes = self._get_subplots()
   File 
"/home/mahmood/.local/lib/python3.8/site-packages/pandas/plotting/_matplotlib/core.py",
 line 903, in _get_subplots
     ax for ax in self.axes[0].get_figure().get_axes() if isinstance(ax, 
Subplot)
AttributeError: 'NoneType' object has no attribute 'get_axes'



I am pretty sure that there is a version mismatch because on a system with 
Pandas 1.3.3 the output should be like https://imgur.com/a/LZ9eAzl

Any feedback is appreciated.

I installed the latest pandas, although on Python 3.10, and the script 
worked without a problem.

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


[issue45847] Port module setup to PY_STDLIB_MOD() macro and addext()

2021-11-21 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
pull_requests: +27928
pull_request: https://github.com/python/cpython/pull/29690

___
Python tracker 

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



[issue45847] Port module setup to PY_STDLIB_MOD() macro and addext()

2021-11-21 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
pull_requests: +27927
pull_request: https://github.com/python/cpython/pull/29689

___
Python tracker 

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



Re: get_axes not present?

2021-11-21 Thread Chris Angelico
On Mon, Nov 22, 2021 at 3:40 AM Mahmood Naderan via Python-list
 wrote:
>   File 
> "/home/mahmood/.local/lib/python3.8/site-packages/pandas/plotting/_matplotlib/core.py",
>  line 903, in _get_subplots
> ax for ax in self.axes[0].get_figure().get_axes() if isinstance(ax, 
> Subplot)
> AttributeError: 'NoneType' object has no attribute 'get_axes'
>

My reading of this is that you're trying to do something that depends
on having an associated figure, but you haven't specified the figure.
Look at documentation and examples for the functions you're calling
and see if one of them depends on a figure.

Your example isn't minimal enough for me to be able to pin it down any
better than that, though.

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


[issue45805] CO_FUTURE_ANNOTATIONS flag is not documented or in inspect

2021-11-21 Thread Éric Araujo

Change by Éric Araujo :


--
stage: resolved -> 
versions: +Python 3.11 -Python 3.7

___
Python tracker 

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



[issue45805] CO_FUTURE_ANNOTATIONS flag is not documented or in inspect

2021-11-21 Thread Éric Araujo

Éric Araujo  added the comment:

I am not sure.  Adding compiler people to the nosy list!

--
nosy: +BTaskaya, Mark.Shannon, benjamin.peterson, brett.cannon, pablogsal, 
yselivanov

___
Python tracker 

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



[issue45857] PEP 604 Union syntax does not support forward references

2021-11-21 Thread Alex Waygood


Alex Waygood  added the comment:

Arguably, either the implementation should be altered to support forward 
references, or the documentation at 
https://docs.python.org/3/library/stdtypes.html#union-type should be altered to 
make clear that, when type-hinting a union that includes a forward reference, 
the entire expression should be given as a string, as Eric suggests.

--

___
Python tracker 

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



[issue45677] [doc] improve sqlite3 docs

2021-11-21 Thread Ian Fisher


Ian Fisher  added the comment:

I think it would also be helpful to make the examples at the top simpler/more 
idiomatic, e.g. using a context manager for the connection and calling 
conn.execute directly instead of spawning a cursor.

I think the information about the isolation_level parameter should also be 
displayed more prominently as many people are surprised to find sqlite3 
automatically opening transactions.

--
nosy: +iafisher

___
Python tracker 

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



[issue26651] Deprecate register_adapter() and register_converter() in sqlite3

2021-11-21 Thread Ian Fisher


Ian Fisher  added the comment:

See bpo-45858 for a more limited proposal to only deprecate the default 
converters.

--

___
Python tracker 

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



[issue45858] Deprecate default converters in sqlite3

2021-11-21 Thread Ian Fisher


Ian Fisher  added the comment:

See also bpo-26651 for a related proposal to deprecate the converter/adapter 
infrastructure entirely.

The proposal in this bug is more limited: remove the default converters (though 
I think the default adapters should stay), but continue to allow users to 
define their own converters.

--

___
Python tracker 

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



[issue45858] Deprecate default converters in sqlite3

2021-11-21 Thread Ian Fisher


New submission from Ian Fisher :

Per discussion at 
https://discuss.python.org/t/fixing-sqlite-timestamp-converter-to-handle-utc-offsets/,
 the default converters in SQLite3 have several bugs and are probably not worth 
continuing to maintain, so I propose deprecating them and removing them in a 
later version of Python.

Since the converters are opt-in, this should not affect most users of SQLite3.

--
components: Library (Lib)
messages: 406727
nosy: erlendaasland, iafisher
priority: normal
severity: normal
status: open
title: Deprecate default converters in sqlite3
type: behavior

___
Python tracker 

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



Re: get_axes not present?

2021-11-21 Thread Mahmood Naderan via Python-list
>The best way to get
>assistance here on the list is to create a minimal, self-contained,
>run-able, example program that you can post in its entirety here that
>demonstrates the issue.


I created a sample code with input. Since the code processes a csv file to 
group input rows, I also included those in this minimal code but those 
preprocesses are not buggy. In this sample code, I used print() to print 
necessary information. The error exists in the plot function. I tested the 
dictionary build before that and it is fine.


Code is available at https://pastebin.com/giAnjJDV  and the input file 
(test.batch.csv) is available https://pastebin.com/Hdp4Wt9B 

The run command is "python3 test.py". With the versions specified in my system, 
here is the full output:





$ python3 test.py
Reading file...
matplotlib version =  3.3.4
pandas version =  1.2.3
sys version sys.version_info(major=3, minor=8, micro=10, releaselevel='final', 
serial=0)
Original dictionary =  {'dummy': Value
M1  0
M2  0
M3  0, 'K1::foo(bar::z(x,u))':    Value  Value
0 10  2
1  5  2
2 10  2, 'K2::foo()':    Value
0 20
1 10
2 15, 'K3::foo(baar::y(z,u))':    Value
0 12
1 13
2 14, 'K3::foo(bar::y(z,u))':    Value
0  6
1  7
2  8}
New dictionary for plot =  {'dummy': Value
M1  0
M2  0
M3  0, 'K1::foo(bar::z(x,u))':    Value  Value
0 10  2
1  5  2
2 10  2, 'K3::foo(bar::y(z,u))':    Value
0  6
1  7
2  8}
Key is  K1::foo(bar::z(x,u))  -> df is Value  Value
0 10  2
1  5  2
2 10  2
axes= [ ]
axes[0]= AxesSubplot(0.125,0.53;0.775x0.35)
cnt= 1
row= 1    10
2 2
Name: 0, dtype: int64
Traceback (most recent call last):
  File "test.py", line 74, in 
    plot_kernels(my_dict2)
  File "test.py", line 52, in plot_kernels
    plot_dataframe(df, cnt, axes)
  File "test.py", line 36, in plot_dataframe
    ax1 = row.plot(label=cnt, ax=axes[0], marker='o')   # Line chart
  File 
"/home/mahmood/.local/lib/python3.8/site-packages/pandas/plotting/_core.py", 
line 955, in __call__
    return plot_backend.plot(data, kind=kind, **kwargs)
  File 
"/home/mahmood/.local/lib/python3.8/site-packages/pandas/plotting/_matplotlib/__init__.py",
 line 61, in plot
    plot_obj.generate()
  File 
"/home/mahmood/.local/lib/python3.8/site-packages/pandas/plotting/_matplotlib/core.py",
 line 283, in generate
    self._adorn_subplots()
  File 
"/home/mahmood/.local/lib/python3.8/site-packages/pandas/plotting/_matplotlib/core.py",
 line 483, in _adorn_subplots
    all_axes = self._get_subplots()
  File 
"/home/mahmood/.local/lib/python3.8/site-packages/pandas/plotting/_matplotlib/core.py",
 line 903, in _get_subplots
    ax for ax in self.axes[0].get_figure().get_axes() if isinstance(ax, Subplot)
AttributeError: 'NoneType' object has no attribute 'get_axes'



I am pretty sure that there is a version mismatch because on a system with 
Pandas 1.3.3 the output should be like https://imgur.com/a/LZ9eAzl

Any feedback is appreciated.


Regards,
Mahmood

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


[issue45847] Port module setup to PY_STDLIB_MOD() macro and addext()

2021-11-21 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
pull_requests: +27926
pull_request: https://github.com/python/cpython/pull/29688

___
Python tracker 

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



Re: Unexpected behaviour of math.floor, round and int functions (rounding)

2021-11-21 Thread Grant Edwards
On 2021-11-21, Greg Ewing  wrote:
> On 21/11/21 2:18 pm, Grant Edwards wrote:
>> My recollection is that it was quite common back in the days before FP
>> hardware was "a thing" on small computers. CPM and DOS compilers for
>> various languages often gave the user a choice between binary FP and
>> decimal (BCD) FP.
>
> It's also very common for handheld calculators to work in decimal.
> Most of HP's classic calculators used a CPU that was specifically
> designed for doing BCD arithmetic, and many versions of it didn't
> even have a way of doing arithmetic in binary!

Yep, IIRC, it was a 4 bit processor because 4 bits is what it takes to
represent one decimal digit. The original Intel µProcessor was a also
4-bit processor designed around BCD rather than base-2 arithmatic
operations.

--
Grant



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


[issue45857] PEP 604 Union syntax does not support forward references

2021-11-21 Thread Eric V. Smith


Eric V. Smith  added the comment:

Presumably the correct way to do this is:

def __init__(self, tmp: "Foo|int"):

That is, the entire type hint is a string.

--
nosy: +eric.smith

___
Python tracker 

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



[issue33125] Windows 10 ARM64 platform support

2021-11-21 Thread Guido van Rossum


Guido van Rossum  added the comment:

I could really use 3.10 here as well.

--
nosy: +Guido.van.Rossum

___
Python tracker 

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



[issue32658] Metacharacter (\) documentation suggestion

2021-11-21 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



[issue45843] Optimizing LOAD_CONST followed by COMPARE_OP (or IS_OP)

2021-11-21 Thread Alex Waygood


Change by Alex Waygood :


--
type:  -> performance

___
Python tracker 

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



[issue32582] chr raises OverflowError

2021-11-21 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



[issue45857] PEP 604 Union syntax does not support forward references

2021-11-21 Thread Alex Waygood


Alex Waygood  added the comment:

Reproduced on 3.11. The error occurs if a type is on the left-hand-side of the 
operand, as well as if a type is on the right-hand-side:

```
>>> int | "str"
Traceback (most recent call last):
  File "", line 1, in 
TypeError: unsupported operand type(s) for |: 'type' and 'str'
>>> "str" | int
Traceback (most recent call last):
  File "", line 1, in 
TypeError: unsupported operand type(s) for |: 'str' and 'type'
```

--
nosy: +AlexWaygood, gvanrossum, kj
title: Type hint for methods -> PEP 604 Union syntax does not support forward 
references
type: compile error -> 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



[issue45843] Optimizing LOAD_CONST followed by COMPARE_OP (or IS_OP)

2021-11-21 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

I agree with Serhiy

--

___
Python tracker 

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



[issue45709] 3.11 regression: tracing with-statement on exit from block

2021-11-21 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
resolution:  -> fixed
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



[issue32936] RobotFileParser.parse() should raise an exception when the robots.txt file is invalid

2021-11-21 Thread Irit Katriel


Irit Katriel  added the comment:

The link to the robots.txt file no longer works, so it's not clear how to 
reproduce the problem you are seeing. Can you post the complete information on 
this issue?

--
nosy: +iritkatriel
status: open -> pending

___
Python tracker 

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



Re: get_axes not present?

2021-11-21 Thread Michael Torrie
On 11/19/21 10:38 AM, Mahmood Naderan wrote:
>> And what is the result of plot()?  Is it a valid object, or is it None?
> 
> Well the error happens on the plot() line. I tried to print some information 
> like this:
> 
> Any thoughts on that?

It's not really possible for us to know what is happening since none of
us are in front of your computer with your code in front of us.  I
cannot run any of your posted code excerpts.  The best way to get
assistance here on the list is to create a minimal, self-contained,
run-able, example program that you can post in its entirety here that
demonstrates the issue. Otherwise all anyone can do is make guesses.

Did you read through the exception message?  It is providing a lot of
information. The message is saying that matplotlib is trying to call
.get_figure() on a self.axes list item, but that is not a valid object,
but is None. The question is, why is that list full of Nones?  Farther
up the traceback it notes that on line 66 of process_csv.py, you make a
call to plot_data() passing it the axes. Perhaps there's something wrong
with the axes object or list you are passing in there.  Did you print
that out to make sure that df, cnt, and axes all contain valid things?

All I can tell you is to use the standard debugging techniques you would
use for any problem.  Use either a debugger or print()'s to print out
the contents and types of each variable to verify they contain the data
you think they do.  If you have nested function calls, break them out
separately so you can examine the inputs and outputs of each of them.
If necessary, trace your way through the matplotlib code, but almost
certainly you'll find the problem is in bad data you are passing to
matplotlib.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue32582] chr raises OverflowError

2021-11-21 Thread Irit Katriel


Irit Katriel  added the comment:

Still raising OVerflowError on 3.11:

>>> print(chr(0x8000))
Traceback (most recent call last):
  File "", line 1, in 
OverflowError: Python int too large to convert to C int

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

___
Python tracker 

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



[issue32658] Metacharacter (\) documentation suggestion

2021-11-21 Thread Irit Katriel


Change by Irit Katriel :


--
keywords: +easy, newcomer friendly
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



[issue45857] Type hint for methods

2021-11-21 Thread 洪明聖

New submission from 洪明聖 :

The class methods have a problem compiling when the type refers to the union of 
itself and others.


# tmp.py
class Foo:
def __init__(self, tmp: "Foo"|int):
pass


# Error
Traceback (most recent call last):
  File "/Project/Mslc/Grammar/tmp.py", line 1, in 
class Foo:
  File "/Project/Mslc/Grammar/tmp.py", line 2, in Foo
def __init__(self, tmp: "Foo"|int):
TypeError: unsupported operand type(s) for |: 'str' and 'type'

--
messages: 406720
nosy: TNThung
priority: normal
severity: normal
status: open
title: Type hint for methods
type: compile error
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



[issue45766] Add direct proportion option to statistics.linear_regression()

2021-11-21 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Thanks for looking at this and giving it some good thought.

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



[issue45766] Add direct proportion option to statistics.linear_regression()

2021-11-21 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset d2b55b07d2b503dcd3b5c0e2753efa835cff8e8f by Raymond Hettinger in 
branch 'main':
bpo-45766: Add direct proportion option to linear_regression(). (#29490)
https://github.com/python/cpython/commit/d2b55b07d2b503dcd3b5c0e2753efa835cff8e8f


--

___
Python tracker 

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



[issue31486] calling a _json.Encoder object raises a SystemError in case obj.items() returned a tuple

2021-11-21 Thread Irit Katriel


Irit Katriel  added the comment:

Closing as fixed since it's too late to change 3.6 (if that did not happen yet).

--
nosy: +iritkatriel

___
Python tracker 

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



[issue31486] calling a _json.Encoder object raises a SystemError in case obj.items() returned a tuple

2021-11-21 Thread Irit Katriel


Change by Irit Katriel :


--
resolution:  -> fixed
stage: needs patch -> resolved
status: open -> closed
versions: +Python 3.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



[issue45804] IDLE - faster shell writing

2021-11-21 Thread wyz23x2


Change by wyz23x2 :


--
assignee:  -> terry.reedy
components: +IDLE

___
Python tracker 

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



[issue45853] Misspelled _IGNORED_ERROS in Lib/pathlib.py

2021-11-21 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

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

--

___
Python tracker 

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



[issue45821] Many method parameters in the datetime module are positional-only in the C implementation but positional-or-keyword in the Python implementation

2021-11-21 Thread Alex Waygood


Alex Waygood  added the comment:

Ref to discussion on typeshed: https://github.com/python/typeshed/pull/6343

--

___
Python tracker 

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



Re: pytest segfault, not with -v

2021-11-21 Thread Barry
I would run the whole set of tests under gdb and wait for the segv to happen.
You may find that an isolated test will pass. Sometimes it is a sequence of test
and lead to the segv.

Barry

> On 19 Nov 2021, at 23:48, Marco Sulla  wrote:
> 
> On Fri, 19 Nov 2021 at 20:38, MRAB  wrote:
>> 
>>> On 2021-11-19 17:48, Marco Sulla wrote:
>>> I have a battery of tests done with pytest. My tests break with a
>>> segfault if I run them normally. If I run them using pytest -v, the
>>> segfault does not happen.
>>> 
>>> What could cause this quantical phenomenon?
>>> 
>> Are you testing an extension that you're compiling? That kind of problem
>> can occur if there's an uninitialised variable or incorrect reference
>> counting (Py_INCREF/Py_DECREF).
> 
> Ok, I know. But why can't it be reproduced if I do pytest -v? This way
> I don't know which test fails.
> Furthermore I noticed that if I remove the __pycache__ dir of tests,
> pytest does not crash, until I re-ran it with the __pycache__ dir
> present.
> This way is very hard for me to understand what caused the segfault.
> I'm starting to think pytest is not good for testing C extensions.
> -- 
> https://mail.python.org/mailman/listinfo/python-list
> 

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


[issue45847] Port module setup to PY_STDLIB_MOD() macro and addext()

2021-11-21 Thread Christian Heimes


Christian Heimes  added the comment:


New changeset 2afa1a12669e1812a9fe8130c8f60052c4ad8bf8 by Christian Heimes in 
branch 'main':
bpo-45847: Port codecs and unicodedata to PY_STDLIB_MOD (GH-29685)
https://github.com/python/cpython/commit/2afa1a12669e1812a9fe8130c8f60052c4ad8bf8


--

___
Python tracker 

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



[issue43827] abc conflicts with __init_subclass__

2021-11-21 Thread Oleg Iarygin


Oleg Iarygin  added the comment:

Paul, PR OP made all changes requested; could you re-review please?

--
nosy: +arhadthedev, p-ganssle

___
Python tracker 

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



[issue45853] Misspelled _IGNORED_ERROS in Lib/pathlib.py

2021-11-21 Thread Badal Sahani


Badal Sahani  added the comment:

Corrected Misspelled _IGNORED_ERROS in Lib/pathlib.py to _IGNORED_ERRORS

--
hgrepos: +411
keywords: +patch
message_count: 3.0 -> 4.0
nosy: +badalsahani
nosy_count: 2.0 -> 3.0
pull_requests: +27925
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/29686
Added file: https://bugs.python.org/file50454/pathlib.py

___
Python tracker 

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



[issue45853] Misspelled _IGNORED_ERROS in Lib/pathlib.py

2021-11-21 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

BTW, is not the correct name _IGNORED_ERRNOS?

--

___
Python tracker 

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



[issue45853] Misspelled _IGNORED_ERROS in Lib/pathlib.py

2021-11-21 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

If it is only used in a single place in the module would not be better to 
inline it?

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue42233] GenericAlias does not support union type expressions

2021-11-21 Thread Dávid Nemeskey

Dávid Nemeskey  added the comment:

@kj Sorry, for some reason, I thought the that issue affected Union as well, 
but I have just re-tested it and found that it works.

--

___
Python tracker 

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



[issue45709] 3.11 regression: tracing with-statement on exit from block

2021-11-21 Thread Ned Batchelder


Ned Batchelder  added the comment:

I can confirm that this fixes the problem.

--

___
Python tracker 

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



[issue45766] Add direct proportion option to statistics.linear_regression()

2021-11-21 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

Hi Raymond,

I'm satisfied that this should be approved. The code looks good to me 
and in my tests it matches the results from other software.

I don't think there is any need to verify that plain OLS regression 
produces an intercept close to zero. (What counts as close to zero?) If 
users want to check that, they can do so themselves.

Regarding my concern with the coefficient of determination, I don't 
think that's enough of a problem that it should delay adding this 
functionality. I don't know what, if anything, should be done, but in 
the meantime we should approve this new feature.

For the record, an example of the problem can be seen on the last slide 
here:

https://www.azdhs.gov/documents/preparedness/state-laboratory/lab-licensure-certification/technical-resources/calibration-training/09-linear-forced-through-zero-calib.pdf

The computed r**2 of 1.0 is clearly too high for the RTO line.

--

___
Python tracker 

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



[issue45847] Port module setup to PY_STDLIB_MOD() macro and addext()

2021-11-21 Thread Christian Heimes


Change by Christian Heimes :


--
pull_requests: +27924
pull_request: https://github.com/python/cpython/pull/29685

___
Python tracker 

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



[issue45846] Incorrect name capitalisation in faq/programming

2021-11-21 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Thank you for your report and PR JMcB.

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



[issue45843] Optimizing LOAD_CONST followed by COMPARE_OP (or IS_OP)

2021-11-21 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Why anybody needs to write 255581293 > 12938373?

We try to keep the compiler code maintenable and only implement optimizations 
which have the largest effect. PR 29639 adds around 200 lines of complex code 
and I do not see the benefit.

--

___
Python tracker 

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



[issue45839] python3 executable is able to install pandas

2021-11-21 Thread Muhammad Irfan Asghar


Muhammad Irfan Asghar  added the comment:

Hi

I am really astonished and I have tried all tricks, help available on
internet. Is there any manual way to do this. i.e open any file and enter
information separately so that ssL certificate issue can be solved. or can
you tell me, how you configured your mac.

Irfan

On Sun, Nov 21, 2021 at 1:45 AM Ned Deily  wrote:

>
> Ned Deily  added the comment:
>
> That is very unusual behavior. Pip has its own private certificate store
> that it uses to make secure connections to pypi.org and the version of
> pip supplied with the python.org 3.10.0 macOS installer should work just
> fine as is. I just verified that it works for me. I'm just guessing here
> but I think the most likely cause of this behavior is that your internet
> connection is behind a misconfigured or malevolent proxy server. You may
> want to check your DNS settings as well to try to use a neutral DNS
> provider. There are discussions of similar problems on the web: try
> searching for: pypi self signed certificate in certificate chain. Good luck!
>
> --
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue45847] Port module setup to PY_STDLIB_MOD() macro and addext()

2021-11-21 Thread Christian Heimes


Christian Heimes  added the comment:


New changeset f201d261cf53365b5769a434ca2bb21a892bd23f by Christian Heimes in 
branch 'main':
bpo-45847: Port grp, spwd, termios, resource, syslog to PY_STDLIB_MOD (GH-29668)
https://github.com/python/cpython/commit/f201d261cf53365b5769a434ca2bb21a892bd23f


--

___
Python tracker 

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