[issue45289] test_dbm and test_dbm_ndbm segfaults in M1 Mac

2021-09-25 Thread Dong-hee Na


Change by Dong-hee Na :


--
nosy: +corona10

___
Python tracker 

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



[issue44603] REPL: exit when the user types exit instead of asking them to explicitly type exit()

2021-09-25 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

> Typing `import sys; sys.exit()` every time I want to test something 
> quick on the REPL is awful UX.

It truly is awful. So why do you do it that way?

There are at least four other ways to cleanly exit the REPL.

1. raise SystemExit

2. exit()

3. quit()

4. Ctrl-D (posix systems) or Ctrl-Z ENTER (Windows systems)

Even if you are running the REPL without the site module (so that exit 
and quit are not available) the import sys solution is surely the worst 
of the lot, UX-wise.

--

___
Python tracker 

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



[issue45290] test_multiprocessing_pool_circular_import fails in M1 mac

2021-09-25 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Seems that the issue went away when configuring the maxfiles with

$ launchctl limit maxfiles

instead of with "ulimit -n"

--
resolution:  -> fixed
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: XML Considered Harmful

2021-09-25 Thread Chris Angelico
On Sun, Sep 26, 2021 at 9:09 AM Eli the Bearded <*@eli.users.panix.com> wrote:
>
> In comp.lang.python, Chris Angelico   wrote:
> > Eli the Bearded <*@eli.users.panix.com> wrote:
> >> I'd use one of the netpbm formats instead of JPEG. PBM for one bit
> >> bitmaps, PGM for one channel (typically grayscale), PPM for three
> >> channel RGB, and PAM for anything else (two channel gray plus alpha,
> >> CMYK, RGBA, HSV, YCbCr, and more exotic formats). JPEG is tricky to
> >> map to CSV since it is a three channel format (YCbCr), where the
> >> channels are typically not at the same resolution. Usually Y is full
> >> size and the Cb and Cr channels are one quarter size ("4:2:0 chroma
> >> subsampling"). The unequal size of the channels does not lend itself
> >> to CSV, but I can't say it's impossible.
> > Examine prior art, and I truly do mean art, from Matt Parker:
> > https://www.youtube.com/watch?v=UBX2QQHlQ_I
>
> His spreadsheet is a PPM file, not a JPEG. You can tell because all of
> the cells are the same size.
>
> He also ignores vector graphics when considering digital images. Often
> they are rendered in what he calls "spreadsheets" but not always. I have
> a Vectrex, for example.
>
> Elijah
> --
> then there's typewriter art with non-square "pixels"

Ah, I remember playing around with line printer art. We mostly had
Epsons and IBMs that did have some measure of graphical capabilities,
but it was WAY faster to print text, so we sometimes did things the
hacky and elegant way instead.

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


Re: XML Considered Harmful

2021-09-25 Thread Eli the Bearded
In comp.lang.python, Chris Angelico   wrote:
> Eli the Bearded <*@eli.users.panix.com> wrote:
>> I'd use one of the netpbm formats instead of JPEG. PBM for one bit
>> bitmaps, PGM for one channel (typically grayscale), PPM for three
>> channel RGB, and PAM for anything else (two channel gray plus alpha,
>> CMYK, RGBA, HSV, YCbCr, and more exotic formats). JPEG is tricky to
>> map to CSV since it is a three channel format (YCbCr), where the
>> channels are typically not at the same resolution. Usually Y is full
>> size and the Cb and Cr channels are one quarter size ("4:2:0 chroma
>> subsampling"). The unequal size of the channels does not lend itself
>> to CSV, but I can't say it's impossible.
> Examine prior art, and I truly do mean art, from Matt Parker:
> https://www.youtube.com/watch?v=UBX2QQHlQ_I

His spreadsheet is a PPM file, not a JPEG. You can tell because all of
the cells are the same size.

He also ignores vector graphics when considering digital images. Often
they are rendered in what he calls "spreadsheets" but not always. I have
a Vectrex, for example.

Elijah
--
then there's typewriter art with non-square "pixels"
-- 
https://mail.python.org/mailman/listinfo/python-list


Posts from gmane no longer allowed?

2021-09-25 Thread Grant Edwards
I've been reading (and posting to) this list for many years by
pointing an NNTP client
at news://gmane.comp.python.general. Sometime in the past few days posts started
being refused:

You have tried posting to gmane.comp.python.general, which is a
unidirectional
mailing list. Gmane can therefore not send this message to that
mailing list.

Was this a change made by the mailing list admins?

If so, is it permanent?

[Trying to send a plaintext e-mail via Gmail, but not sure if it's working.]

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


[issue45290] test_multiprocessing_pool_circular_import fails in M1 mac

2021-09-25 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

> ulimit -n 1000

If i do this, the test hangs some times instead of crashing

--

___
Python tracker 

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



[issue45249] Update doctect SyntaxErrors for location range

2021-09-25 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

Terry: I got it mostly working using your 2nd suggestion, I will do some 
testing and should be able to put up a PR in the next couple of days. Thanks 
for looking at this and explaining!

--

___
Python tracker 

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



Re: XML Considered Harmful

2021-09-25 Thread dn via Python-list
On 26/09/2021 10.48, 2qdxy4rzwzuui...@potatochowder.com wrote:
> On 2021-09-25 at 15:20:19 -0500,
> "Michael F. Stemper"  wrote:
> 
>> ... For instance, if
>> I modeled a fuel like this:
>>
>>   
>> ton
>> 21.96
>> 18.2
>>   
...


> Disclaimer:  I am not a big XML fan, for a number of reasons
> already stated in this thread.
> 
> That said, please do include units in elements like heat_content,
> whether or not it's Joules/kilogram/K, and price, even if is the
> local currency in the only country to which your data applies.
> If there's a standard for your industry, or your company, or on
> some other level, then at least document what it is and that
> you're using it, so that the next person (which may be you a
> year from now) doesn't have to guess.

+1
*always* add unit attributes
-- 
Regards,
=dn
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: XML Considered Harmful

2021-09-25 Thread dn via Python-list
On 26/09/2021 10.07, Stefan Ram wrote:
> "Michael F. Stemper"  writes:
>>   fitting hierarchical
>> data into rows/columns just seems wrong
> 
>   There were hierarchical database management systems like
>   IMS by IBM based on that point of view. Today, almost all
>   hierarchical data that is stored in databases is stored
>   in relational databases. Maybe, the relational model has
>   proven superior to the hierarchical data model after all.


Back in the days of mainframes (and when the Flintstones was 'filmed
before a live studio audience') hierarchical DBs were considerably
faster than RDBMS. Because of this, we used to take a daily 'snapshot'
of the transaction DBs (in IMS) and make a 'copy' as DB2 relational DBs,
which were (supposedly) used for MIS (Management Information Systems -
as distinct from TPS (Transaction Processing Systems)).

These days RDBMS are (a lot!) faster - much of which would be better
expressed as: the hardware these days is a lot faster. Therefore an
RDBMS is sufficiently responsive, and we no-longer need to maintain
separate, 'parallel' systems (and multiple mainframes)!

Cue: NoSQL justifications...

Today's best example of an hierarchical DB is probably LDAP. It is most
commonly used within the 'directory' of communications systems, eg
email. Such waters muddied considerably by MSFT's attempts to 'improve'
international 'standards' and integrate AD with Exchange (so don't go
there!).

There have been some well-engineered systems based on LDAP, eg
organisational/personnel and part/component break-downs.

That said, unless looking at something such as just-mentioned,
overlaying hierarchy onto 3NF and using an RDBMS would be my first
thought - but because of the recursive JOINs, I recommend something more
capable than SQLite.
-- 
Regards,
=dn
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue45290] test_multiprocessing_pool_circular_import fails in M1 mac

2021-09-25 Thread Ned Deily


Ned Deily  added the comment:

As a first step, try adding:

ulimit -n 1000

to the buildbot test step.

--

___
Python tracker 

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



Re: XML Considered Harmful

2021-09-25 Thread 2QdxY4RzWzUUiLuE
On 2021-09-25 at 15:20:19 -0500,
"Michael F. Stemper"  wrote:

> ... For instance, if
> I modeled a fuel like this:
> 
>   
> ton
> 21.96
> 18.2
>   
> 
> and a generating unit like this:
> 
>   
> 
>   
>   
>   
>   
> 
> 
>   
>   
>   
>   
> 
>   
> 
> why would the fact that I could have chosen, instead, to model
> the unit of measure as an attribute of the fuel, or its name
> as a sub-element matter? Once the modeling decision has been
> made, all of the decisions that might have been would seem to
> be irrelevant.

Disclaimer:  I am not a big XML fan, for a number of reasons
already stated in this thread.

That said, please do include units in elements like heat_content,
whether or not it's Joules/kilogram/K, and price, even if is the
local currency in the only country to which your data applies.
If there's a standard for your industry, or your company, or on
some other level, then at least document what it is and that
you're using it, so that the next person (which may be you a
year from now) doesn't have to guess.

You also never know when someone else on the other side of the
planet will notice your work and try to duplicate it and/or
update it (again, even if it's you).  The fewer assumptions
that person has to make, the better.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue45290] test_multiprocessing_pool_circular_import fails in M1 mac

2021-09-25 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

The same test sometimes hangs forever

--

___
Python tracker 

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



RE: XML Considered Harmful

2021-09-25 Thread Avi Gross via Python-list
Michael,

I don't care what you choose. Whatever works is fine for an internal use.

But is the data scheme you share representative of your actual application?

>From what I see below, unless the number of "point" variables is not always
exactly four, the application might be handled well by any format that
handles rectangular data, perhaps even CSV.

You show a I mean anything like a data.frame can contain data columns like
p1,p2,p3,p4 and a categorical one like IHRcurve_name.

Or do you have a need for more variability such as an undetermined number of
similar units in ways that might require more flexibility or be more
efficient done another way?

MOST of the discussion I am seeing here seems peripheral to getting you what
you need for your situation and may require a learning curve to learn to use
properly. Are you planning on worrying about how to ship your data
encrypted, for example? Any file format you use for storage can presumably
be encrypted and send and decrypted if that matters.

So, yes, from an abstract standpoint we can discuss the merits of various
approaches. If it matters that humans can deal with your data in a file or
that it be able to be imported into a program like EXCEL, those are
considerations. But if not, there are quite a few relatively binary formats
where your program can save a snapshot of the data into a file and read it
back in next time. I often do that in another language that lets me share
variable including nested components such as the complex structures that
come out of a statistical analysis or the components needed to make one or
more graphs later. If you write the program that creates the darn things as
well as the one that later reads them back in, you can do what you want.

Or, did I miss something and others have already produced the data using
other tools, in which case you have to read it in at least once/ 

-Original Message-
From: Python-list  On
Behalf Of Michael F. Stemper
Sent: Saturday, September 25, 2021 4:20 PM
To: python-list@python.org
Subject: Re: XML Considered Harmful

On 21/09/2021 13.12, Michael F. Stemper wrote:

> If XML is not the way to package data, what is the recommended 
> approach?

Well, there have been a lot of ideas put forth on this thread, many more
than I expected. I'd like to thank everyone who took the time to contribute.

Most of the reasons given for avoiding XML appear to be along the lines of
"XML has all of these different options that it supports."

However, it seems that I could ignore 99% of those things and just use a
teeny subset of its capabilities. For instance, if I modeled a fuel like
this:

   
 ton
 21.96
 18.2
   

and a generating unit like this:

   
 
   
   
   
   
 
 
   
   
   
   
 
   

why would the fact that I could have chosen, instead, to model the unit of
measure as an attribute of the fuel, or its name as a sub-element matter?
Once the modeling decision has been made, all of the decisions that might
have been would seem to be irrelevant.

Some years back, IEC's TC57 came up with CIM[1]. This nailed down a lot of
decisions. The fact that other decisions could have been made doesn't seem
to keep utilities from going forward with it as an enterprise-wide data
model.

My current interests are not anywhere so expansive, but it seems that the
situations are at least similar:
1. Look at an endless range of options for a data model.
2. Pick one.
3. Run with it.

To clearly state my (revised) question:

   Why does the existence of XML's many options cause a problem
   for my use case?


Other reactions:

Somebody pointed out that some approaches would require that I climb a
learning curve. That's appreciated, although learning new things is always
good.

NestedText looks cool, and a lot like YAML. Having not gotten around to
playing with YAML yet, I was surprised to learn that it tries to guess data
types. This sounds as if it could lead to the same type of problems that led
to the names of some genes being turned into dates.

It was suggested that I use an RDBMS, such as sqlite3, for the input data.
I've used sqlite3 for real-time data exchange between concurrently-running
programs. However, I don't see syntax like:

sqlite> INSERT INTO Fuels
...> (name,uom,price,heat_content)
...> VALUES ("Montana Sub-Bituminous", "ton", 21.96, 13.65);

as being nearly as readable as the XML that I've sketched above.
Yeah, I could write a program to do this, but that doesn't really change
anything, since I'd still need to get the data into the program.

(Changing a value would be even worse, requiring the dreaded UPDATE INTO
statement, instead of five seconds in vi.)

Many of the problems listed for CSV, which come from its lack of
standardization, seem similar to those given for XML. "Commas or tabs?" "How
are new-lines represented?" If I was to use CSV, I'd be able to just pick
answers. However, fitting hierarchical data into rows/columns 

[issue45026] More compact range iterator

2021-09-25 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

I did more benchmarks on my Windows laptop, and it seems the difference goes 
away after using PGO.

The benchmarking program:

#

from pyperf import Runner

runner = Runner()

for n in [10, 100, 1000, 10_000, 100_000]:
runner.timeit(f"for i in range({n}): pass",
stmt=f"for i in range({n}): pass")

runner.timeit(f"for i in it_{n}: pass",
setup=f"it = iter(range({n}))",
stmt="for i in it: pass")

runner.timeit(f"deque(it_{n})",
  setup=(f"from collections import deque; "
 f"it = iter(range({n}))"),
  stmt="deque(it, maxlen=0)")

runner.timeit(f"list(iter(range({n})))",
  stmt=f"list(iter(range({n})))")

###

The results (without PGO):

PS C:\Users\sween\Source\Repos\cpython2\cpython> .\python.bat -m pyperf 
compare_to .\20e3149c175a24466c7d1c352f8ff2c11effc489.json 
.\cffa90a8b0057d7e7456571045f2fb7b9ceb426f.json -G
Running Release|x64 interpreter...
Slower (15):
- list(iter(range(100))): 741 ns +- 13 ns -> 836 ns +- 11 ns: 1.13x slower
- for i in range(10): pass: 2.05 ms +- 0.05 ms -> 2.26 ms +- 0.06 ms: 1.10x 
slower
- list(iter(range(1000))): 12.2 us +- 0.1 us -> 13.2 us +- 0.2 us: 1.08x slower
- for i in range(1): pass: 203 us +- 4 us -> 219 us +- 4 us: 1.08x slower
- for i in range(100): pass: 1.18 us +- 0.02 us -> 1.27 us +- 0.03 us: 1.08x 
slower
- for i in range(1000): pass: 18.1 us +- 0.3 us -> 19.5 us +- 0.3 us: 1.07x 
slower
- list(iter(range(1))): 145 us +- 7 us -> 152 us +- 2 us: 1.05x slower
- list(iter(range(10))): 1.98 ms +- 0.06 ms -> 2.06 ms +- 0.05 ms: 1.04x 
slower
- for i in range(10): pass: 265 ns +- 9 ns -> 272 ns +- 8 ns: 1.03x slower
- deque(it_1000): 324 ns +- 4 ns -> 332 ns +- 8 ns: 1.02x slower
- deque(it_10): 327 ns +- 5 ns -> 333 ns +- 7 ns: 1.02x slower
- list(iter(range(10))): 357 ns +- 7 ns -> 363 ns +- 3 ns: 1.02x slower
- deque(it_10): 325 ns +- 5 ns -> 330 ns +- 5 ns: 1.01x slower
- deque(it_100): 325 ns +- 6 ns -> 329 ns +- 4 ns: 1.01x slower
- deque(it_1): 326 ns +- 7 ns -> 330 ns +- 4 ns: 1.01x slower

Faster (2):
- for i in it_10: pass: 26.0 ns +- 1.4 ns -> 25.3 ns +- 0.3 ns: 1.03x faster
- for i in it_1000: pass: 25.7 ns +- 0.7 ns -> 25.3 ns +- 0.4 ns: 1.02x faster

Benchmark hidden because not significant (3): for i in it_100: pass, for i in 
it_1: pass, for i in it_10: pass

Geometric mean: 1.03x slower

###

The results (with PGO):

PS C:\Users\sween\Source\Repos\cpython2\cpython> .\python.bat -m pyperf 
compare_to .\PGO-20e3149c175a24466c7d1c352f8ff2c11effc489.json 
.\PGO-cffa90a8b0057d7e7456571045f2fb7b9ceb426f.json -G
Running PGUpdate|x64 interpreter...
Slower (7):
- for i in it_100: pass: 20.3 ns +- 0.5 ns -> 21.3 ns +- 0.7 ns: 1.05x slower
- for i in it_1: pass: 20.4 ns +- 0.6 ns -> 21.4 ns +- 0.8 ns: 1.05x slower
- for i in it_10: pass: 20.5 ns +- 0.5 ns -> 21.4 ns +- 0.6 ns: 1.05x slower
- for i in it_1000: pass: 20.3 ns +- 0.5 ns -> 21.2 ns +- 0.5 ns: 1.05x slower
- for i in it_10: pass: 20.3 ns +- 0.5 ns -> 21.1 ns +- 0.5 ns: 1.04x slower
- for i in range(10): pass: 214 ns +- 3 ns -> 219 ns +- 11 ns: 1.03x slower
- deque(it_10): 288 ns +- 5 ns -> 291 ns +- 12 ns: 1.01x slower

Faster (7):
- list(iter(range(1))): 112 us +- 3 us -> 96.4 us +- 3.4 us: 1.16x faster
- list(iter(range(1000))): 9.69 us +- 0.15 us -> 8.39 us +- 0.26 us: 1.15x 
faster
- list(iter(range(10))): 1.65 ms +- 0.04 ms -> 1.48 ms +- 0.04 ms: 1.11x 
faster
- list(iter(range(100))): 663 ns +- 11 ns -> 623 ns +- 12 ns: 1.06x faster
- for i in range(1000): pass: 14.6 us +- 0.5 us -> 14.2 us +- 0.3 us: 1.03x 
faster
- for i in range(1): pass: 162 us +- 2 us -> 159 us +- 3 us: 1.02x faster
- for i in range(10): pass: 1.64 ms +- 0.03 ms -> 1.62 ms +- 0.04 ms: 1.01x 
faster

Benchmark hidden because not significant (6): deque(it_10), 
list(iter(range(10))), for i in range(100): pass, deque(it_100), 
deque(it_1000), deque(it_1)

Geometric mean: 1.01x faster

--

___
Python tracker 

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



Could not initilalize crash reporting DB

2021-09-25 Thread Sir Real via Python-list
I have a script that chooses a paragraph at random from a text file
then uses that paragraph to generate and send an email message. It's
set up to run on Windows 7 startup. It has run without issue more than
400 times.

Recently two consecutive runs produced the following messages...

Could not initialize crash reporting DB
Cannot init crashpad with status: CRASHPAD_INIT_DB_ERROR

Despite the messages the script otherwise ran as expected.

Google searches turned up nothing useful. I was hoping that maybe
someone here could tell me what these messages mean.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue45290] test_multiprocessing_pool_circular_import fails in M1 mac

2021-09-25 Thread Pablo Galindo Salgado


New submission from Pablo Galindo Salgado :

==
FAIL: test_multiprocessing_pool_circular_import 
(test.test_importlib.test_threaded_import.ThreadedImportTests)
--
Traceback (most recent call last):
  File 
"/Users/pablogsal/github/cpython/Lib/test/test_importlib/test_threaded_import.py",
 line 258, in test_multiprocessing_pool_circular_import
script_helper.assert_python_ok(fn)
^^
  File "/Users/pablogsal/github/cpython/Lib/test/support/script_helper.py", 
line 160, in assert_python_ok
return _assert_python(True, *args, **env_vars)
   ^^^
  File "/Users/pablogsal/github/cpython/Lib/test/support/script_helper.py", 
line 145, in _assert_python
res.fail(cmd_line)
^^
  File "/Users/pablogsal/github/cpython/Lib/test/support/script_helper.py", 
line 72, in fail
raise AssertionError("Process return code is %d\n"
^^
AssertionError: Process return code is 1
command line: ['/Users/pablogsal/github/cpython/python.exe', '-X', 
'faulthandler', '-I', 
'/Users/pablogsal/github/cpython/Lib/test/test_importlib/partial/pool_in_threads.py']

stdout:
---

---

stderr:
---
Traceback (most recent call last):
Traceback (most recent call last):
Traceback (most recent call last):
Traceback (most recent call last):
Traceback (most recent call last):
Traceback (most recent call last):
Traceback (most recent call last):
Traceback (most recent call last):
  File 
"/Users/pablogsal/github/cpython/Lib/test/test_importlib/partial/pool_in_threads.py",
 line 9, in t
with multiprocessing.Pool(1):
 ^^^
  File "/Users/pablogsal/github/cpython/Lib/multiprocessing/context.py", line 
119, in Pool
  File "/Users/pablogsal/github/cpython/Lib/multiprocessing/pool.py", line 212, 
in __init__
  File "/Users/pablogsal/github/cpython/Lib/multiprocessing/pool.py", line 303, 
in _repopulate_pool
  File "/Users/pablogsal/github/cpython/Lib/multiprocessing/pool.py", line 326, 
in _repopulate_pool_static
  File "/Users/pablogsal/github/cpython/Lib/multiprocessing/process.py", line 
121, in start
self._popen = self._Popen(self)
  ^
  File "/Users/pablogsal/github/cpython/Lib/multiprocessing/context.py", line 
284, in _Popen
return Popen(process_obj)
   ^^
  File 
"/Users/pablogsal/github/cpython/Lib/multiprocessing/popen_spawn_posix.py", 
line 32, in __init__
super().__init__(process_obj)
^
  File "/Users/pablogsal/github/cpython/Lib/multiprocessing/popen_fork.py", 
line 19, in __init__
self._launch(process_obj)
^
  File 
"/Users/pablogsal/github/cpython/Lib/multiprocessing/popen_spawn_posix.py", 
line 53, in _launch
parent_r, child_w = os.pipe()
^
  File 
"/Users/pablogsal/github/cpython/Lib/test/test_importlib/partial/pool_in_threads.py",
 line 9, in t
with multiprocessing.Pool(1):
 ^^^
OSError: [Errno 24] Too many open files
/Users/pablogsal/github/cpython/Lib/multiprocessing/resource_tracker.py:224: 
UserWarning: resource_tracker: There appear to be 65 leaked semaphore objects 
to clean up at shutdown
  warnings.warn('resource_tracker: There appear to be %d '
/Users/pablogsal/github/cpython/Lib/multiprocessing/resource_tracker.py:237: 
UserWarning: resource_tracker: '/mp-m8lbung6': [Errno 2] No such file or 
directory
  warnings.warn('resource_tracker: %r: %s' % (name, e))
/Users/pablogsal/github/cpython/Lib/multiprocessing/resource_tracker.py:237: 
UserWarning: resource_tracker: '/mp-w8c_ci83': [Errno 2] No such file or 
directory
  warnings.warn('resource_tracker: %r: %s' % (name, e))
/Users/pablogsal/github/cpython/Lib/multiprocessing/resource_tracker.py:237: 
UserWarning: resource_tracker: '/mp-yzcaa23b': [Errno 2] No such file or 
directory
  warnings.warn('resource_tracker: %r: %s' % (name, e))
/Users/pablogsal/github/cpython/Lib/multiprocessing/resource_tracker.py:237: 
UserWarning: resource_tracker: '/mp-vgij30u5': [Errno 2] No such file or 
directory
  warnings.warn('resource_tracker: %r: %s' % (name, e))
---

--
Ran 1428 tests in 2.752s

FAILED (failures=1, skipped=6, expected failures=1)
test test_importlib failed
test_importlib failed (1 failure)

== Tests result: FAILURE ==

6 tests OK.

--
components: Tests, macOS
messages: 402648
nosy: ned.deily, pablogsal, ronaldoussoren
priority: normal
severity: normal
status: open
title: test_multiprocessing_pool_circular_import fails in M1 mac
versions: Python 3.10, Python 3.11, Python 3.9

___
Python tracker 


Re: XML Considered Harmful

2021-09-25 Thread Michael F. Stemper

On 21/09/2021 13.12, Michael F. Stemper wrote:


If XML is not the way to package data, what is the recommended
approach?


Well, there have been a lot of ideas put forth on this thread,
many more than I expected. I'd like to thank everyone who
took the time to contribute.

Most of the reasons given for avoiding XML appear to be along
the lines of "XML has all of these different options that it
supports."

However, it seems that I could ignore 99% of those things and
just use a teeny subset of its capabilities. For instance, if
I modeled a fuel like this:

  
ton
21.96
18.2
  

and a generating unit like this:

  

  
  
  
  


  
  
  
  

  

why would the fact that I could have chosen, instead, to model
the unit of measure as an attribute of the fuel, or its name
as a sub-element matter? Once the modeling decision has been
made, all of the decisions that might have been would seem to
be irrelevant.

Some years back, IEC's TC57 came up with CIM[1]. This nailed down
a lot of decisions. The fact that other decisions could have been
made doesn't seem to keep utilities from going forward with it as
an enterprise-wide data model.

My current interests are not anywhere so expansive, but it seems
that the situations are at least similar:
1. Look at an endless range of options for a data model.
2. Pick one.
3. Run with it.

To clearly state my (revised) question:

  Why does the existence of XML's many options cause a problem
  for my use case?


Other reactions:

Somebody pointed out that some approaches would require that I
climb a learning curve. That's appreciated, although learning
new things is always good.

NestedText looks cool, and a lot like YAML. Having not gotten
around to playing with YAML yet, I was surprised to learn that it
tries to guess data types. This sounds as if it could lead to the
same type of problems that led to the names of some genes being
turned into dates.

It was suggested that I use an RDBMS, such as sqlite3, for the
input data. I've used sqlite3 for real-time data exchange between
concurrently-running programs. However, I don't see syntax like:

sqlite> INSERT INTO Fuels
   ...> (name,uom,price,heat_content)
   ...> VALUES ("Montana Sub-Bituminous", "ton", 21.96, 13.65);

as being nearly as readable as the XML that I've sketched above.
Yeah, I could write a program to do this, but that doesn't really
change anything, since I'd still need to get the data into the
program.

(Changing a value would be even worse, requiring the dreaded
UPDATE INTO statement, instead of five seconds in vi.)

Many of the problems listed for CSV, which come from its lack of
standardization, seem similar to those given for XML. "Commas
or tabs?" "How are new-lines represented?" If I was to use CSV,
I'd be able to just pick answers. However, fitting hierarchical
data into rows/columns just seems wrong, so I doubt that I'll
end up going that way.

As far as disambiguating authors, I believe that most journals
are now expecting an ORCID[2] (which doesn't help with papers
published before that came around).

As far as use of XML to store program state, I wouldn't ever
consider that. As noted above, I've used an RDBMS to do so.
It handles all of the concurrency issues for me. The current use
case is specifically for raw, static input.

Fascinating to find out that XML was originally designed to
mark up text, especially legal text.

It was nice to be reminded of what Matt Parker looked like when
he had hair.


[1] 
[2] 
--
Michael F. Stemper
Psalm 82:3-4
--
https://mail.python.org/mailman/listinfo/python-list


[issue41914] test_pdb fails

2021-09-25 Thread Léon Planken

Léon Planken  added the comment:

So I went ahead to fix the issue and created a PR. I also signed the CLA, but I 
understand that needs a little time to process.
I was bold/forward enough to add myself to the ACKS. Please feel remove me if 
this contribution is too trivial.

--

___
Python tracker 

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



[issue41914] test_pdb fails

2021-09-25 Thread Léon Planken

Change by Léon Planken :


--
pull_requests: +26948
pull_request: https://github.com/python/cpython/pull/28564

___
Python tracker 

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



[issue45289] test_dbm and test_dbm_ndbm segfaults in M1 Mac

2021-09-25 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
title: test_gdbm segfaults in M1 Mac -> test_dbm and test_dbm_ndbm segfaults in 
M1 Mac

___
Python tracker 

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



[issue45289] test_gdbm segfaults in M1 Mac

2021-09-25 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

See https://buildbot.python.org/all/#/builders/725/builds/4

--

___
Python tracker 

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



[issue44603] REPL: exit when the user types exit instead of asking them to explicitly type exit()

2021-09-25 Thread Eryk Sun


Eryk Sun  added the comment:

Running the REPL with -S is unusual, so having to use sys.exit() or `raise 
SystemExit` in that case shouldn't be an issue. 

A user who wants custom behavior for `exit` could override sys.displayhook() in 
the PYTHONSTARTUP file. For example:

import sys
import builtins

def displayhook(obj, prev_displayhook=sys.displayhook):
exit = getattr(builtins, 'exit', None)
if obj is exit and callable(exit):
exit()
else:
prev_displayhook(obj)

sys.displayhook = displayhook

> just note that you can always do Ctrl-D.

For the Windows console, Ctrl-D is not usually supported. It's supported when 
pyreadline is installed. Otherwise one has to type Ctrl-Z and enter. In IDLE 
it's Ctrl-D even in Windows, in which case the `exit` repr is wrong, as 
determined by setquit() in Lib/site.py.

--
nosy: +eryksun

___
Python tracker 

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



[issue45289] test_gdbm segfaults in M1 Mac

2021-09-25 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
components: +macOS -Tests
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



[issue45289] test_gdbm segfaults in M1 Mac

2021-09-25 Thread Pablo Galindo Salgado


New submission from Pablo Galindo Salgado :

0:04:14 load avg: 3.86 [141/427/1] test_dbm crashed (Exit code -11)
Fatal Python error: Segmentation fault
Current thread 0x000102e2bd40 (most recent call first):
  File 
"/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/Lib/test/test_dbm.py",
 line 58 in keys_helper
  File 
"/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/Lib/test/test_dbm.py",
 line 143 in read_helper
  File 
"/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/Lib/test/test_dbm.py",
 line 74 in test_anydbm_creation
  File 
"/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/Lib/unittest/case.py",
 line 547 in _callTestMethod
  File 
"/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/Lib/unittest/case.py",
 line 591 in run
  File 
"/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/Lib/unittest/case.py",
 line 646 in __call__
  File 
"/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/Lib/unittest/suite.py",
 line 122 in run
  File 
"/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/Lib/unittest/suite.py",
 line 84 in __call__
  File 
"/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/Lib/unittest/suite.py",
 line 122 in run
  File 
"/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/Lib/unittest/suite.py",
 line 84 in __call__
  File 
"/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/Lib/unittest/suite.py",
 line 122 in run
  File 
"/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/Lib/unittest/suite.py",
 line 84 in __call__
  File 
"/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/Lib/unittest/runner.py",
 line 197 in run
  File 
"/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/Lib/test/support/__init__.py",
 line 992 in _run_suite
  File 
"/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/Lib/test/support/__init__.py",
 line 1118 in run_unittest
  File 
"/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/Lib/test/libregrtest/runtest.py",
 line 261 in _test_module
  File 
"/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/Lib/test/libregrtest/runtest.py",
 line 297 in _runtest_inner2
  File 
"/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/Lib/test/libregrtest/runtest.py",
 line 340 in _runtest_inner
  File 
"/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/Lib/test/libregrtest/runtest.py",
 line 202 in _runtest
  File 
"/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/Lib/test/libregrtest/runtest.py",
 line 245 in runtest
  File 
"/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/Lib/test/libregrtest/runtest_mp.py",
 line 83 in run_tests_worker
  File 
"/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/Lib/test/libregrtest/main.py",
 line 678 in _main
  File 
"/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/Lib/test/libregrtest/main.py",
 line 658 in main
  File 
"/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/Lib/test/libregrtest/main.py",
 line 736 in main
  File 
"/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/Lib/test/regrtest.py",
 line 43 in _main
  File 
"/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/Lib/test/regrtest.py",
 line 47 in 
  File 
"/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/Lib/runpy.py",
 line 86 in _run_code
  File 
"/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/Lib/runpy.py",
 line 196 in _run_module_as_main
Extension modules: _testcapi (total: 1)
0:04:15 load avg: 3.87 [142/427/1] test_c_

The backtrace according to lldb:

(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS 
(code=1, address=0x10365c000)
  * frame #0: 0x000182bc6994 libsystem_platform.dylib`_platform_memmove + 84
frame #1: 0x0001000b71d0 python.exe`PyBytes_FromStringAndSize(str="c", 
size=4294967297) at bytesobject.c:165:5
frame #2: 0x00010360b234 
_dbm.cpython-311d-darwin.so`_dbm_dbm_keys_impl(self=0x0001034b3ca0, 
cls=0x00010088a580) at _dbmmodule.c:249:16
frame #3: 0x00010360af34 
_dbm.cpython-311d-darwin.so`_dbm_dbm_keys(self=0x0001034b3ca0, 
cls=0x00010088a580, args=0x0001007991d8, nargs=0, 
kwnames=0x) at _dbmmodule.c.h:46:20
frame #4: 0x0001000dca8c 
python.exe`method_vectorcall_FASTCALL_KEYWORDS_METHOD(func=0x0001034db290, 
args=0x0001007991d0, nargsf=9223372036854775809, 
kwnames=0x) at descrobject.c:367:24
frame #5: 0x000100252374 
python.exe`_PyObject_VectorcallTstate(tstate=0x000100808b30, 
callable=0x0001034db290, 

[Python-announce] PyCon Tanzania 2021 - Call for Presentations and Workshop

2021-09-25 Thread Noah .
Dear Python Community,

We hope that you are all well to that end and that you have been busy
working on various awesome Python Projects. It's that time of the year
folks and we would like to engage the community for another conference and
workshops during the first week of December 2021.

PyCon Tanzania, is seeking speakers of all experience levels and
backgrounds to contribute to the Python Conference program! If you use the
Python programming language professionally, as a hobbyist or are just
excited about Python or programming and open source communities, we'd love
to hear from you. We want you and your ideas at the upcoming Python
Conference!

*We are looking for presenters who would:*

- Offer a technical tutorial on an appropriate topic;
- Participate in the technical conference sessions as a speaker;
- Convene and chair panel sessions of relevant topics.

*Topics must be relevant to the Python Language and Open Source Software:*

   - Python usage in your Project
   - Python usage in Research
   - Machine Learning
   - Artificial Intelligence
   - Open Source Software
   - Cyber Security
   - Content Development
   - Gaming and Machine Vision
   - Cloud Computing & Virtualisation
   - Ideas on improving diversity and inclusiveness
   - Functional programming etc
   - Data Science

*SUBMIT YOUR PRESENTATION / TUTORIAL BEFORE 15th NOV 2021 **TO*:*
sp...@pycon.or.tz
 *

*More details on timelines are here; *
http://www.pycon.or.tz/speak/index.html
*PyCon 2021 will take place in ARUSHA.*

Regards,
PyCon Tanzania 2021 Program Committee
http://www.pycon.or.tz/
___
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


[issue45285] c_char incorrectly treated as bytes in Structure

2021-09-25 Thread CireSnave


CireSnave  added the comment:

Wow.  Thank you Eryk Sun.  While that seems like a convoluted way to make a 
type act like the type it is...it works.  Verified it with the following code:

from ctypes import POINTER, c_char, sizeof, Structure


class char_from_c(c_char):
pass


print("Size of c_char vs size of char_from_c:")
print(sizeof(c_char))
print(sizeof(char_from_c))


class my_structure(Structure):
_fields_ = [
("first_char", char_from_c),
("second_char", char_from_c),
("third_char", char_from_c),
]


my_structure_object: my_structure = my_structure(97, 98, 99)

pointer_to_char_from_c_in_my_structure = 
POINTER(c_char)(my_structure_object.first_char)

print("\nContents of pointer_to_char_from_c_in_my_structure:")
print(pointer_to_char_from_c_in_my_structure.contents)
print("\npointer_to_char_from_c_in_my_Structure[0]:")
print(pointer_to_char_from_c_in_my_structure[0])

print("\nValues from my_structure_object:")
character_counter = 0
while character_counter < sizeof(my_structure_object):
print(pointer_to_char_from_c_in_my_structure[character_counter])
character_counter += 1



...which gave me the following results:

Size of c_char vs size of char_from_c:
1
1

Contents of pointer_to_char_from_c_in_my_structure:
c_char(b'a')

pointer_to_char_from_c_in_my_Structure[0]:
b'a'

Values from my_structure_object:
b'a'
b'b'
b'c'


Again...Thank you.  Closing this "bug" as it is weird...but not a bug.

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



[issue45283] Top / function argument level ClassVar should not be allowed during `get_type_hints()`

2021-09-25 Thread Nikita Sobolev


Nikita Sobolev  added the comment:

Thank you, Ken Jin! Very clear explanation!

> It seems the current consensus is to use that import for code with purely 
> static typing, and not use it with runtime typing libraries.

Is it an official position? Or just a common usage pattern?
What can we do to make this more widely known?

Maybe we can formulate something like "When to use: raw, string, future 
annotations" in the typing docs (https://docs.python.org/3/library/typing.html)?

--

___
Python tracker 

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



[issue45283] Top / function argument level ClassVar should not be allowed during `get_type_hints()`

2021-09-25 Thread Ken Jin


Ken Jin  added the comment:

> 1. By adding the same `_type_check` logic we can reduce the inconsistency 
> between two versions. It would be easier for users to migrate from one 
> version to another.

That's definitely a plus. But please consider this hypothetical scenario:

- Let's say some typing code has _type_check in 3.8
- In 3.12, we decide to give type hinting with ints (like `x: 1`) some meaning 
(this has been proposed before in typing-sig).
- The new construct arrives in 3.12. We backport to typing_extensions, which 
*must* support 3.8's typing module.
- Now the new addition to 3.12 typing_extensions doesn't work with 3.8 typing 
because of _type_check, and we need to hack around it.
- The hacks may eventually lead to real behavioral inconsistencies between 
typing_extensions and typing.

If this sounds familiar, that's because something similar has already happened! 
Callable and Generic had too strict checking in typing (requiring Callable's 
args to be a tuple of types always) before 3.10. So typing_extensions doesn't 
support the full PEP 612 syntax :( 
https://github.com/python/typing/tree/master/typing_extensions#other-notes-and-limitations.

Stricter runtime type checking makes growing the typing syntax harder. For the 
newer types, we try to defer checking to 3rd-party libraries.

> Because I received quite a lot of bug reports from users involving different 
> behavior with / without `__future__` import of `annotations`.

Your perspective as a runtime typing library dev is very valuable. Thank you 
for your feedback! IMO, `from __future__ import annotations` becoming the 
default in 3.11 is still undecided. It was yanked from 3.10 for breaking 
pydantic and FastAPI, and I doubt it will land in 3.11 for the same reasons. It 
seems the current consensus is to use that import for code with purely static 
typing, and not use it with runtime typing libraries.

--

___
Python tracker 

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



[issue45026] More compact range iterator

2021-09-25 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

There is nothing in code that could explain a measureable difference in 
creating the range objects or the range object iterators. And indeed, it is in 
the range of the standard deviation, so it is non-existent.

--

___
Python tracker 

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



[issue45287] zipfile.is_zipfile returns true for a rar file containing zips

2021-09-25 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> is_zipfile false positives

___
Python tracker 

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



[issue45286] zipfile missing API for links

2021-09-25 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Improve zipfile: add support for symlinks

___
Python tracker 

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



[issue37921] Improve zipfile: add support for symlinks

2021-09-25 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Adding support of symlinks in ZIP files will make the zipfile module vulnerable 
to symlink attacks like like with TAR files (see 
https://en.wikipedia.org/wiki/Tar_(computing)#Duplicates). Until we find a 
solution to this, adding support of symlinks is dangerous.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue45288] Inspect - Added sort_result parameter on getmembers function.

2021-09-25 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

But you will not get them in creation order, even if omit the final sort, 
because:

1. dir() returns names sorted alphabetically, not in order of creation.
2. Dynamic class attributes are added at the end, and inherited attributes 
follow attributes defined in that class.

So adding this parameter will not help you.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue45283] Top / function argument level ClassVar should not be allowed during `get_type_hints()`

2021-09-25 Thread Nikita Sobolev


Nikita Sobolev  added the comment:

Just to bring in some context for this discussion: 
https://github.com/python/cpython/pull/28279

We have dicussed in the PR above that current implementation depends on 
existing of `__future__` import of `annotations`.

With `from __future__ import annotations`:
1. Top level class var will be raise `TypeError`
2. Final and ClassVar function arguments will raise `TypeError`
3. Annotations like `x: 1` will raise `TypeError: Forward references must 
evaluate to types. Got 1.`

Without `from __future import annotations`it accepts all the cases above.

I share two opposite views on this change:
1. By adding the same `_type_check` logic we can reduce the inconsitency 
between two versions. It would be easier for users to migrate from one version 
to another.
2. By adding this feature, we would more aggresively force some specific 
semantics for builtin types. Which can possibly be problematic, for example 
I've tried to add `Final` annotations to function arguments in my own type 
checker. It is something current semantics does not support. Moreover, it can 
cause incompatibility to existing users.

My opinion is that consitency is more important here. Because I received quite 
a lot of bug reports from users involving different behavior with / without 
`__future__` import of `annotations`.

But, I understand that it is not up to me to decide :)

--

___
Python tracker 

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



Re: XML Considered Harmful

2021-09-25 Thread Jon Ribbens via Python-list
On 2021-09-25, Peter J. Holzer  wrote:
> On 2021-09-24 23:32:47 -, Jon Ribbens via Python-list wrote:
>> JSON Schema provides a way to denote composite types.
>
> I probably wasn't clear what I meant. In XML, every element has a tag,
> which is basically its type. So by looking at an XML file (without
> reference to a schema) you can tell what each element is. And a
> validator can say something like "expected a 'product' or 'service'
> element here but found a 'person'".
>
> In JSON everything is just an object or a list. You may guess that an
> object with a field "product_id" is a product, but is one with "name":
> "Billy" a person or a piece of furniture?
>
> I'm not familiar with JSON schema (I know that it exists and I've read a
> tutorial or two but I've never used it in a real project), but as far as
> I know it doesn't change that. It describes the structure of a JSON
> document but it doesn't add type information to that document. So a
> validator can at best guess what the malformed thing it just found was
> supposed to be.

JSON Schema absolutely does change that. You can create named types
and specify where they may appear in the document. With a well-defined
schema you do not need to make any guesses about what type something is.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue44892] Configparser fails when the .cfg file contains inline 'comments'

2021-09-25 Thread Diego Ramirez


Diego Ramirez  added the comment:

Sure, thanks!

--

___
Python tracker 

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



Re: Different "look and feel" of some built-in functions

2021-09-25 Thread Dieter Maurer
Steve Keller wrote at 2021-9-25 00:15 +0200:
>"Dieter Maurer"  writes:
>
>> Steve Keller wrote at 2021-9-24 11:48 +0200:
>> >Why do some built-in Python functions feel so differently:
>>
>> Because the typical use cases are different
>>
>> [...]
>>
>> >while other functions like set.union() and set.intersection() work on
>> >a list of arguments but not on a sequence:
>> >
>> >set.intersection({1,2,3}, {3,4,5})
>>
>> Those operations are typically applied to a small number
>> of operands. You would need to build an iterator in that
>> case should the functions only accept iterators.
>
>In my experience I need intersection and union on a list of sets, set
>of sets or a map() returning sets much more often.  E.g. in some
>mathematical problems, and in automaton theory (IIRC, computing of LR
>or LALR sets, converting NFA to DFA, minimizing DFA), many graph
>algorithms traversing the nodes (shortest path, ...), and so on).

I, too, occasionally work with set operations on many operands
-- in the context of `Zope`, more precisely `BTrees`.
There, I have both `union(op1, op2)` and `multiunion(iterator)`
(`multiunion` is there primarily for efficiency reasons).

I you often have operations on large sets of operands,
you could define corresponding "convernience functions".



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


Re: Different "look and feel" of some built-in functions

2021-09-25 Thread Chris Angelico
On Sun, Sep 26, 2021 at 2:27 AM Dieter Maurer  wrote:
>
> Stefan Ram wrote at 2021-9-24 16:48 GMT:
> >"Dieter Maurer"  writes:
> >>A list is ordered. Therefore, it is important where
> >>in this order an element is added. Thus, for a list,
> >>`append` is a better name than `add` -- because it already
> >>tells us in the name where it adds the new element.
> >
> >  In a collection of texts, which is not large but mixed from
> >  many different fields and genres, I find (using a Python
> >  script, of course) eight hits for "added to the list" :
> >
> >|s and rock n roll can be added to the list. As - Taylor, 2012
> >| of opinion was probably added to the list tow - from a dictionary
> >|gg and his wife might be added to the list of  - Sir Walter Scott
> >|ships when your name was added to the list. In - Percy Bysshe Shelley
> >|em that wealth should be added to the list. No - Henry
> >|n was discovered and was added to the list of  - from a dictionary
> >|nd said his name must be added to the list, or - Mark Twain
>
> While a list is ordered,
> applications using a list may not be interested in the particular
> order and thus just speak of "add to the list"
> rather than "append to the list".
>
> Nevertheless, I find the name `append` far better than `add` for
> the list type - because it describes better what it is doing.
> I am a big fan of "speaking names".

Yeah, so I would say it makes perfectly good sense to do something like this:

def add_customer(...):
cust = ...
customers.append(cust)

where it's "add" in your application, but "append" in Python's list object.

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


[issue45020] Freeze all modules imported during startup.

2021-09-25 Thread Marc-Andre Lemburg


Marc-Andre Lemburg  added the comment:

On 25.09.2021 18:20, STINNER Victor wrote:
> 
> STINNER Victor  added the comment:
> 
> Marc-Andre: I suppose that you're talking about LANDMARK in Modules/getpath.c 
> and PC/getpathp.c.

Now that you mention it: yes, that as well :-) But os.py is used in the
Python stdlib code as well, just search for "os.__file__" to see a few
such uses.

If you search for ".__file__" you'll find that there are quite a few
cases in the test suite expecting that attribute on other stdlib modules
as well. The attribute may officially be optional, but in reality a
lot of code expects to find it.

--

___
Python tracker 

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



Re: Different "look and feel" of some built-in functions

2021-09-25 Thread Dieter Maurer
Stefan Ram wrote at 2021-9-24 16:48 GMT:
>"Dieter Maurer"  writes:
>>A list is ordered. Therefore, it is important where
>>in this order an element is added. Thus, for a list,
>>`append` is a better name than `add` -- because it already
>>tells us in the name where it adds the new element.
>
>  In a collection of texts, which is not large but mixed from
>  many different fields and genres, I find (using a Python
>  script, of course) eight hits for "added to the list" :
>
>|s and rock n roll can be added to the list. As - Taylor, 2012
>| of opinion was probably added to the list tow - from a dictionary
>|gg and his wife might be added to the list of  - Sir Walter Scott
>|ships when your name was added to the list. In - Percy Bysshe Shelley
>|em that wealth should be added to the list. No - Henry
>|n was discovered and was added to the list of  - from a dictionary
>|nd said his name must be added to the list, or - Mark Twain

While a list is ordered,
applications using a list may not be interested in the particular
order and thus just speak of "add to the list"
rather than "append to the list".

Nevertheless, I find the name `append` far better than `add` for
the list type - because it describes better what it is doing.
I am a big fan of "speaking names".

>  . There was no hit for "appended to the list".
>
>  When one says "add something to a list", it is usually understood
>  that one adds it at the /end/. In the case of traditional written
>  lists it is not possible in any other way.

Really? Prepending should be as possible as appending
(if one disregards implementation details).



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


[issue45020] Freeze all modules imported during startup.

2021-09-25 Thread STINNER Victor


STINNER Victor  added the comment:

Marc-Andre: I suppose that you're talking about LANDMARK in Modules/getpath.c 
and PC/getpathp.c.

--

___
Python tracker 

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



[issue21302] time.sleep (floatsleep()) should use clock_nanosleep() on Linux

2021-09-25 Thread STINNER Victor


STINNER Victor  added the comment:

> Do you have any information about when will be it released in 3.11?

Here is a schedule of Python 3.11 releases:
https://www.python.org/dev/peps/pep-0664/

In the meanwhile, you can develop a C extension to get the feature.

--

___
Python tracker 

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



[Python-announce] EuroPython Society: General Assembly 2021

2021-09-25 Thread Marc-Andre Lemburg
As last year, we are holding the General Assembly (GA) of the EuroPython
Society (EPS) online for this year.

General Assembly


In accordance with our bylaws, we are calling for the EuroPython Society
General Assembly to be held on Sunday, October 10th 2020, from 19:00 -
21:00 CEST. We will use a Zoom meeting to hold the event and send around
the URL closer to the event.

All EPS members are welcome to join and vote at the meeting. Please be
aware that we cannot allow non-EPS members to join, as we often do at
the in-person GAs we hold at the conference, since we would then not be
able to control access to the Zoom call.

Board Nominations
-

As every year, we will vote in a new board. We have already sent out the
list of board nominations in a separate blog post on 2021-09-23. Please
see that post for details on the candidates and the nomination process.

Motions by the Members
--

EuroPython Society Members can propose motions to be put forward and
voted on at the General Assembly.

If you want to put forward a motion, please send this to
bo...@europython.eu no later than Sunday, 2021-10-03, so that we can add
them to the agenda. The bylaws require that any such motions be
announced no later than 5 days before the GA and we will need time to
clarify details and prepare the agenda.

Agenda
--

We will publish the agenda with all motions put forward by the board and
the members on Tuesday, 2020-10-05. The agenda will follow the template
set out in our bylaws under section 8.

https://www.europython-society.org/bylaws

Reports
---

All reports for the GA will be published on Friday, 2020-10-08, to give
the members enough time to read them and prepare questions. We’ll then
answer any questions at the GA.


Help spread the word


Please help us spread this message by sharing it on your social
networks as widely as possible. Thank you !

Link to the blog post:

https://www.europython-society.org/europython-society-general-assembly-2021/

Tweet:

https://twitter.com/europythons/status/1441788705514065921

Thanks,
--
EuroPython Society
https://www.europython-society.org/

___
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


[Python-announce] PyEmpaq 0.2

2021-09-25 Thread Facundo Batista
PyEmpaq is a simple but powerful Python packer to run any project with
any virtualenv dependencies anywhere.

With PyEmpaq you can convert any Python project into a single `.pyz`
file with all the project's content packed inside.

That single file is everything that needs to be distributed. When the
final user executes it, the original project will be expanded, its
dependencies installed in a virtualenv, and then executed. Note that
no special permissions or privileges are required, as everything
happens in the user environment.

Both the packaging and the execution are fully multiplatorm. This
means that you can pack a project in Linux, Windows, Mac or whatever,
and it will run ok in Linux, Windows, Mac or whatever.


This version brings the following change:

- Now all the information for packing comes from the config file.


PyEmpaq can be installed directly from PyPI:

pip install --user --upgrade --ignore-installed pyempaq

If you have `fades` you don't even need to install pyempaq, just run it:

fades -d pyempaq -x pyempaq


Check the project for all the information, including a couple of demo
gifs showing PyEmpaq in action and examples for packed programs:

https://github.com/facundobatista/pyempaq/

Regards,

-- 
.Facundo

Blog: http://www.taniquetil.com.ar/plog/
PyAr: http://www.python.org.ar/
Twitter: @facundobatista
___
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


EuroPython Society: General Assembly 2021

2021-09-25 Thread Marc-Andre Lemburg
As last year, we are holding the General Assembly (GA) of the EuroPython
Society (EPS) online for this year.

General Assembly


In accordance with our bylaws, we are calling for the EuroPython Society
General Assembly to be held on Sunday, October 10th 2020, from 19:00 -
21:00 CEST. We will use a Zoom meeting to hold the event and send around
the URL closer to the event.

All EPS members are welcome to join and vote at the meeting. Please be
aware that we cannot allow non-EPS members to join, as we often do at
the in-person GAs we hold at the conference, since we would then not be
able to control access to the Zoom call.

Board Nominations
-

As every year, we will vote in a new board. We have already sent out the
list of board nominations in a separate blog post on 2021-09-23. Please
see that post for details on the candidates and the nomination process.

Motions by the Members
--

EuroPython Society Members can propose motions to be put forward and
voted on at the General Assembly.

If you want to put forward a motion, please send this to
bo...@europython.eu no later than Sunday, 2021-10-03, so that we can add
them to the agenda. The bylaws require that any such motions be
announced no later than 5 days before the GA and we will need time to
clarify details and prepare the agenda.

Agenda
--

We will publish the agenda with all motions put forward by the board and
the members on Tuesday, 2020-10-05. The agenda will follow the template
set out in our bylaws under section 8.

https://www.europython-society.org/bylaws

Reports
---

All reports for the GA will be published on Friday, 2020-10-08, to give
the members enough time to read them and prepare questions. We’ll then
answer any questions at the GA.


Help spread the word


Please help us spread this message by sharing it on your social
networks as widely as possible. Thank you !

Link to the blog post:

https://www.europython-society.org/europython-society-general-assembly-2021/

Tweet:

https://twitter.com/europythons/status/1441788705514065921

Thanks,
--
EuroPython Society
https://www.europython-society.org/

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


[issue45283] Top / function argument level ClassVar should not be allowed during `get_type_hints()`

2021-09-25 Thread Ken Jin


Ken Jin  added the comment:

This makes ``get_type_hints`` quite opinionated and backwards incompatible. The 
first line the docs says "This is often the same as obj.__annotations__".

I also agree with Guido. FYI, we've tried to *reduce* usage of `_type_check` in 
new features since version 3.10. We've found that they make `typing_extensions` 
operability with `typing` worse. For example, the whole of PEP 612 in 
`typing_extensions` required lots of hacks to work with typing's Callable.

If you're really vouching for this change. We probably need a 2 major version 
deprecation period (with warnings telling the user their current type hints are 
invalid) *plus* asking typing-sig/python-dev if the runtime type hints users 
will be affected. See [PEP 387](https://www.python.org/dev/peps/pep-0387/) for 
more info.

On the other hand, we now have a less-opinionated alternative to 
``get_type_hints`` with ``inspect.get_annotations``, but it can't do as much 
(like resolving ForwardRef).

--
nosy: +kj

___
Python tracker 

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



[issue21302] time.sleep (floatsleep()) should use clock_nanosleep() on Linux

2021-09-25 Thread Benjamin Szőke

Benjamin Szőke  added the comment:

Do you have any information about when will be it released in 3.11?

--

___
Python tracker 

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



[issue45020] Freeze all modules imported during startup.

2021-09-25 Thread Guido van Rossum

Guido van Rossum  added the comment:

The plan is to add __file__ back, based on where the stdlib lives (we won’t do 
any stat() calls for frozen files).

--

___
Python tracker 

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



[issue45283] Top / function argument level ClassVar should not be allowed during `get_type_hints()`

2021-09-25 Thread Guido van Rossum


Guido van Rossum  added the comment:

Hm. IMO it is up to static type checkers to reject bad use of types. The 
runtime should be relaxed so type checkers can develop new features assigning 
new semantics to such constructs.

--
nosy: +gvanrossum

___
Python tracker 

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



[issue45288] Inspect - Added sort_result parameter on getmembers function.

2021-09-25 Thread Cristobal Riaga


Cristobal Riaga  added the comment:

Added sort_result parameter (bool=True) on getmembers function inside 
Lib/inspect.py, that, as it name says, allows you to getmembers result without 
sorting it.
I'm needed of this and it seems impossible to achieve because of 367 line:

results.sort(key=lambda pair: pair[0])

Any other solution is very welcomed.

(I need it because I'm working on an API Reference creator and I think it would 
be better if it the members are ordered in the same order you define them.)

--

___
Python tracker 

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



[issue45288] Inspect - Added sort_result parameter on getmembers function.

2021-09-25 Thread Cristobal Riaga


New submission from Cristobal Riaga :

Added `sort_result` parameter (`bool=True`)  on `getmembers` function inside 
`Lib/inspect.py`, that, as it name says, allows you to `getmembers` result 
without sorting it.
I'm needed of this and it seems impossible to achieve because of [`367` 
line](https://github.com/python/cpython/blob/3.9/Lib/inspect.py#L367): 
```py
results.sort(key=lambda pair: pair[0])
```
Any other solution is very welcomed.

(I need it because I'm working on an [API Reference 
creator](https://github.com/Patitotective/PyAPIReference) and I think it would 
be better if it the members are ordered in the same order you define them.)

--
components: Library (Lib)
messages: 402626
nosy: Patitotective
priority: normal
pull_requests: 26947
severity: normal
status: open
title: Inspect - Added sort_result parameter on getmembers function.
versions: Python 3.8

___
Python tracker 

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



[issue44892] Configparser fails when the .cfg file contains inline 'comments'

2021-09-25 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
title: Configparser fails when the .cfg file contains comments -> Configparser 
fails when the .cfg file contains inline 'comments'

___
Python tracker 

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



[issue44892] Configparser fails when the .cfg file contains comments

2021-09-25 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Please report back on the pip issue to read more of the doc, about inline 
comments in
https://docs.python.org/3/library/configparser.html#customizing-parser-behaviour
like I should have before writing what I did.

--
resolution:  -> not a bug
stage: test needed -> 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



[issue45287] zipfile.is_zipfile returns true for a rar file containing zips

2021-09-25 Thread mxmlnkn


New submission from mxmlnkn :

I have created a RAR file containing two zip files like this:

zip bag.zip README.md CHANGELOG.md
zip bag1.zip CHANGELOG.md
rar a zips.rar bag.zip bag1.zip

And when calling `zipfile.is_zipfile` on zips.rar, it returns true even though 
it obviously is not a zip. The zips.rar file doesn't even begin with the magic 
bytes `PK` for zip but with `Rar!`.

--
files: zips.rar
messages: 402624
nosy: mxmlnkn
priority: normal
severity: normal
status: open
title: zipfile.is_zipfile returns true for a rar file containing zips
Added file: https://bugs.python.org/file50305/zips.rar

___
Python tracker 

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



[issue44603] REPL: exit when the user types exit instead of asking them to explicitly type exit()

2021-09-25 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

> Typing `import sys; sys.exit()` every time I want to test something quick on 
> the REPL is awful UX.

Without disagreeing with the general sentiment, just note that you can always 
do Ctrl-D.

--

___
Python tracker 

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



[issue41914] test_pdb fails

2021-09-25 Thread Léon Planken

Léon Planken  added the comment:

Here's the issue again when running test_pdb.py for 3.11 (repository main). The 
same problem now occurs twice, and only inside the `screen` environment.

- 8< -

~/Temp/cpython> ./python Lib/test/test_pdb.py
.F.F
==
FAIL: test_errors_in_command (__main__.PdbTestCase)
--
Traceback (most recent call last):
  File "/home/leon/Temp/cpython/Lib/test/test_pdb.py", line 1847, in 
test_errors_in_command
self.assertEqual(stdout.splitlines()[1:], [
^^^
AssertionError: Lists differ: ['-> [278 chars]efined", 'LEAVING RECURSIVE 
DEBUGGER', '(Pdb) ', '\x1b[?1034h'] != ['-> [278 chars]efined", 'LEAVING 
RECURSIVE DEBUGGER', '(Pdb) ']

First list contains 1 additional elements.
First extra element 10:
'\x1b[?1034h'

  ['-> pass',
   "(Pdb) *** SyntaxError: '(' was never closed",
   '(Pdb) ENTERING RECURSIVE DEBUGGER',
   "*** SyntaxError: '(' was never closed",
   'LEAVING RECURSIVE DEBUGGER',
   '(Pdb) ENTERING RECURSIVE DEBUGGER',
   '> (1)()',
   "((Pdb)) *** NameError: name 'doesnotexist' is not defined",
   'LEAVING RECURSIVE DEBUGGER',
-  '(Pdb) ',
?  ^

+  '(Pdb) ']
?  ^

-  '\x1b[?1034h']

==
FAIL: test_issue34266 (__main__.PdbTestCase)
do_run handles exceptions from parsing its arg
--
Traceback (most recent call last):
  File "/home/leon/Temp/cpython/Lib/test/test_pdb.py", line 1875, in 
test_issue34266
check('\\', 'No escaped character')
^^^
  File "/home/leon/Temp/cpython/Lib/test/test_pdb.py", line 1870, in check
self.assertEqual(stdout.splitlines()[1:], [
^^^
AssertionError: Lists differ: ['-> [13 chars] *** Cannot run \\: No escaped 
character', '(Pdb) \x1b[?1034h'] != ['-> [13 chars] *** Cannot run \\: No 
escaped character', '(Pdb) ']

First differing element 2:
'(Pdb) \x1b[?1034h'
'(Pdb) '

- ['-> pass',
-  '(Pdb) *** Cannot run \\: No escaped character',
+ ['-> pass', '(Pdb) *** Cannot run \\: No escaped character', '(Pdb) ']
? +++ ++

-  '(Pdb) \x1b[?1034h']

--
Ran 56 tests in 2.850s

FAILED (failures=2)

--
versions: +Python 3.11 -Python 3.10

___
Python tracker 

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



[issue44892] Configparser fails when the .cfg file contains comments

2021-09-25 Thread Diego Ramirez


Diego Ramirez  added the comment:

Hi Terry, I didn't see your response. I think this won't be possible, taking in 
count the comment that Serhiy posted:

> By default configparser does not support inline comments. "#  percentage sign 
> '%'" is a part of value. If you want to support inline comments you should 
> pass the inline_comment_prefixes argument.

Maybe this is a reasonable behavior. What do you think about it?

--

___
Python tracker 

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



Re: XML Considered Harmful

2021-09-25 Thread Karsten Hilbert
Am Fri, Sep 24, 2021 at 08:59:23PM +0200 schrieb Peter J. Holzer:

> JSON: Has a few primitive data types (bool, number, string) and a two
> compound types (list, dict(string -> any)). Still missing many
> frequently used data types (e.g. dates)

But that (dates) at least has a well-known mapping to string,
which makes it usable within JSON.

Karsten
--
GPG  40BE 5B0E C98E 1713 AFA6  5BC0 3BEA AC80 7D4F C89B
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue44603] REPL: exit when the user types exit instead of asking them to explicitly type exit()

2021-09-25 Thread Filipe Laíns

Filipe Laíns  added the comment:

> In my view, that's exactly why it _shouldn't_ have a special treatment. After 
> all, site can add many more builtins. Do you want all of them to have 
> autocall?

No, and I did not suggest anything of the sort. I just want the exit because of 
its integral job of... exiting the REPL. Typing `import sys; sys.exit()` every 
time I want to test something quick on the REPL is awful UX.

--

___
Python tracker 

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



[issue21302] time.sleep (floatsleep()) should use clock_nanosleep() on Linux

2021-09-25 Thread STINNER Victor


STINNER Victor  added the comment:

Thanks Livius for all these nice enhancements!

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



[issue21302] time.sleep (floatsleep()) should use clock_nanosleep() on Linux

2021-09-25 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 7834ff26cbcd4d8394d64d80d9f51a364d38b1c6 by Victor Stinner in 
branch 'main':
bpo-21302: Add nanosleep() implementation for time.sleep() in Unix (GH-28545)
https://github.com/python/cpython/commit/7834ff26cbcd4d8394d64d80d9f51a364d38b1c6


--

___
Python tracker 

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



[issue45286] zipfile missing API for links

2021-09-25 Thread mxmlnkn


New submission from mxmlnkn :

When using zipfile as a library to get simple files, there is no way to method 
to determine whether a ZipInfo object is a link or not. Moreover, links can be 
simply opened and read like normal files and will contain the link path, which 
is unexpected in most cases, I think.

ZipInfo already has an `is_dir` getter. It would be nice if there also was an 
`is_link` getter. Note that `__repr__` actually shows the filemode, which is 
`lrwxrwxrwx`. But there is not even a getter for the file mode.

For now, I can try to use the code from `__repl__` to extract the file mode 
from the `external_attr` member but the contents of that member are not 
documented in zipfile and assuming it is the same as in the ZIP file format 
specification, it's OS-dependent.

Additionally to `is_link` some getter like `linkname` or so would be nice. As 
to how it should behave when calling `open` or `read` on a link, I'm not sure.

--
messages: 402617
nosy: mxmlnkn
priority: normal
severity: normal
status: open
title: zipfile missing API for links

___
Python tracker 

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



Re: XML Considered Harmful

2021-09-25 Thread Peter J. Holzer
On 2021-09-24 23:32:47 -, Jon Ribbens via Python-list wrote:
> On 2021-09-24, Chris Angelico  wrote:
> > On Sat, Sep 25, 2021 at 8:53 AM dn via Python-list
> > wrote:
> >> On 25/09/2021 06.59, Peter J. Holzer wrote:
> >> > CSV: Good for tabular data of a single data type (strings). As soon as
> >> > there's a second data type (numbers, dates, ...) you leave standard
> >> > territory and are into "private agreements".
> 
> CSV is not good for strings, as there is no one specification of how to
> encode things like newlines and commas within the strings, so you may
> find that your CSV data transfer fails or even silently corrupts data.

Those two cases are actually pretty straightforward: Just enclose the
field in quotes.

Handling quotes is less standardized. I think doubling quotes is much more
common than an escape character, but I've certainly seen both.

But if you get down to it, the problems with CSV start at a much lower
level:

1) The encoding is not defined. These days UTF-8 (with our without BOM)
is pretty common, but I still regularly get files in Windows-1252
encoding and occasionally something else.

2) The record separator isn't defined. CRLF is most common, followed by
   LF. But just recently I got a file with CR (Does Eurostat still use
   some Macs with MacOS 9?)

3) The field separator isn't defined. Officially the format is known as
   "comma separated values", but in my neck of the woods it's actually
   semicolon-separated in the vast majority of cases.

So even for the most simple files there are three parameters the sender
and the receiver have to agree on.


> >> > JSON: Has a few primitive data types (bool, number, string) and a two
> >> > compound types (list, dict(string -> any)). Still missing many
> >> > frequently used data types (e.g. dates) and has no standard way to
> >> > denote composite types. But its simple and if it's sufficient for your
> >> > needs, use it.
> 
> JSON Schema provides a way to denote composite types.

I probably wasn't clear what I meant. In XML, every element has a tag,
which is basically its type. So by looking at an XML file (without
reference to a schema) you can tell what each element is. And a
validator can say something like "expected a 'product' or 'service'
element here but found a 'person'".

In JSON everything is just an object or a list. You may guess that an
object with a field "product_id" is a product, but is one with "name":
"Billy" a person or a piece of furniture?

I'm not familiar with JSON schema (I know that it exists and I've read a
tutorial or two but I've never used it in a real project), but as far as
I know it doesn't change that. It describes the structure of a JSON
document but it doesn't add type information to that document. So a
validator can at best guess what the malformed thing it just found was
supposed to be.

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


[issue45283] Top / function argument level ClassVar should not be allowed during `get_type_hints()`

2021-09-25 Thread Nikita Sobolev


Change by Nikita Sobolev :


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

___
Python tracker 

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



[issue43914] Highlight invalid ranges in SyntaxErrors

2021-09-25 Thread Łukasz Langa

Łukasz Langa  added the comment:

This is complete now. Thanks! ✨  ✨

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

___
Python tracker 

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



[issue43914] Highlight invalid ranges in SyntaxErrors

2021-09-25 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset c523022ba8f81a3661b4ac8be81706ed095d5769 by Łukasz Langa in 
branch '3.10':
[3.10] bpo-43914: What's New 3.10: add new SyntaxError attributes (GH-28558) 
(GH-28562)
https://github.com/python/cpython/commit/c523022ba8f81a3661b4ac8be81706ed095d5769


--

___
Python tracker 

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



[issue45166] get_type_hints + Final + future annotations = TypeError

2021-09-25 Thread Łukasz Langa

Łukasz Langa  added the comment:

Thanks for the report Timothee, and Nikita for the fix! ✨  ✨

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



[issue45166] get_type_hints + Final + future annotations = TypeError

2021-09-25 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset 1f08d16c90b6619607fe0656328062ab986cce29 by Łukasz Langa in 
branch '3.9':
[3.9] bpo-45166: fixes `get_type_hints` failure on `Final` (GH-28279) (GH-28561)
https://github.com/python/cpython/commit/1f08d16c90b6619607fe0656328062ab986cce29


--

___
Python tracker 

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



[issue45166] get_type_hints + Final + future annotations = TypeError

2021-09-25 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset d312b8516e11027ce97897d39764e242f0f57087 by Miss Islington (bot) 
in branch '3.10':
bpo-45166: fixes `get_type_hints` failure on `Final` (GH-28279) (GH-28560)
https://github.com/python/cpython/commit/d312b8516e11027ce97897d39764e242f0f57087


--

___
Python tracker 

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



[issue43914] Highlight invalid ranges in SyntaxErrors

2021-09-25 Thread Łukasz Langa

Change by Łukasz Langa :


--
pull_requests: +26945
pull_request: https://github.com/python/cpython/pull/28562

___
Python tracker 

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



[issue43914] Highlight invalid ranges in SyntaxErrors

2021-09-25 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset 71f8ff45c62bd6b792919ac7c3804a8628ae12cb by Terry Jan Reedy in 
branch 'main':
bpo-43914: Whats New 310: add new SyntaxError attributes (GH-28558)
https://github.com/python/cpython/commit/71f8ff45c62bd6b792919ac7c3804a8628ae12cb


--
nosy: +lukasz.langa

___
Python tracker 

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



Re: Different "look and feel" of some built-in functions

2021-09-25 Thread Oscar Benjamin
On Sat, 25 Sept 2021 at 02:16, Chris Angelico  wrote:

> On Sat, Sep 25, 2021 at 11:11 AM Oscar Benjamin
>  wrote:
> >
> > On Sat, 25 Sept 2021 at 02:01, Chris Angelico  wrote:
> >>
> >> On Sat, Sep 25, 2021 at 10:56 AM Oscar Benjamin
> >>  wrote:
> >> >
> >> > On Sat, 25 Sept 2021 at 00:37, Greg Ewing <
> greg.ew...@canterbury.ac.nz>
> >> > wrote:
> >> > > I suppose they could be fiddled somehow to make it possible, but
> >> > > that would be turning them into special cases that break the rules.
> >> > > It would be better to provide separate functions, as was done with
> >> > > sum().
> >> > >
> >> >
> >> > A separate union function would be good. Even in a situation where all
> >> > inputs are assured to be sets the set.union method fails the base
> case:
> >> >
> >> > >>> sets = []
> >> > >>> set.union(*sets)
> >> > Traceback (most recent call last):
> >> >   File "", line 1, in 
> >> > TypeError: descriptor 'union' of 'set' object needs an argument
> >> >
> >> > In the case of intersection perhaps the base case should be undefined.
> >> >
> >>
> >> Rather than calling the unbound method, why not just call it on an
> >> empty set? That defines your base case as well.
> >>
> >> set().union(*sets)
> >
> >
> > That is indeed what I do but it seems unnatural compared to simply
> union(*sets). It shouldn't be necessary to create a redundant empty set
> just to compute the union of some other sets. If there was a union function
> then I don't think I would ever use the union method.
> >
>
> Maybe, but if you start with a set, then you define the base case, and
> it also is quite happy to take non-set arguments:
>
> >>> set().union([1,2,3], map(int, "234"), {3:"three",4:"four",5:"five"})
> {1, 2, 3, 4, 5}


Actually it should be union(sets) rather than union(*sets). A more
realistic example is when you need the union of sets given by something
like a generator expression so it looks like:

items = set().union(*(f(x) for x in stuff))

With a union function it should look like:

items = union(f(x) for x in stuff)

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


[issue45166] get_type_hints + Final + future annotations = TypeError

2021-09-25 Thread Łukasz Langa

Change by Łukasz Langa :


--
pull_requests: +26944
pull_request: https://github.com/python/cpython/pull/28561

___
Python tracker 

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



[issue45166] get_type_hints + Final + future annotations = TypeError

2021-09-25 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset 784905dbeff68cf788bbeefe0a675af1af04affc by Nikita Sobolev in 
branch 'main':
bpo-45166: fixes `get_type_hints` failure on `Final` (GH-28279)
https://github.com/python/cpython/commit/784905dbeff68cf788bbeefe0a675af1af04affc


--
nosy: +lukasz.langa

___
Python tracker 

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



[issue45166] get_type_hints + Final + future annotations = TypeError

2021-09-25 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 2.0 -> 3.0
pull_requests: +26943
pull_request: https://github.com/python/cpython/pull/28560

___
Python tracker 

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



[issue45020] Freeze all modules imported during startup.

2021-09-25 Thread Marc-Andre Lemburg


Marc-Andre Lemburg  added the comment:

Eric, I noticed that you are freezing os.py. Please be aware that
this module is often being used as indicator for where the stdlib
was installed (the stdlib itself does this in site.py to read the
LICENSE and the test suite also uses os.__file__ in a couple of
places).

It may be worth changing the stdlib to pick a different module
as landmark for this purpose.

Also: Unless you have added the .__file__ attribute to frozen
modules, much of this landmark checking code will fail... which is
the reason I added the attribute to frozen modules in PyRun.

--

___
Python tracker 

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



[issue42969] pthread_exit & PyThread_exit_thread from PyEval_RestoreThread etc. are harmful

2021-09-25 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

**If** we add a callback API for this, I agree with vstinner's 
https://bugs.python.org/issue42969#msg402558 commentary on the other callback 
APIs.  We can do this one similarly and keep it simple. - Why? It's the initial 
simplicity that provides those running into this problem a way to solve their 
problem today.  Without getting hung up on the details of the new default 
behavior.

**That said** the only conclusion I'm coming to for what the safest behavior of 
Python is in this situation is to hang the threads, effectively as PR 28525 is 
proposing.

So even if we added the callback API, I'd expect code using Python with C++ 
where these issues might ever crop up to always register a thread hanging 
callback.  Which really suggests it is the good default.  So do we even need 
the callback?

...But lets put the default behavior choice aside for a moment, there's 
something valuable regardless...

There are **New C APIs to enhance PyGILState_Ensure** proposed in PR 28525 to 
do with GIL acquisition from threads.  These appear useful as is.  They provide 
a way for threads to discover that they will never be able to get the GIL and 
re-enter the Python interpreter.  Rather than today's unexpected behavior of 
PyGILState_Ensure mercilessly terminating their thread, or given a Callback API 
whatever effect such a Callback API would have.  That allows code to be written 
with pre-problem-detection that avoids entering this point of no return state.  
That is good for everyone.  **We should add those "GIL-curious" APIs no matter 
what.**  This bit could become its own PR separate from the other parts.

If we cannot agree that blocking a non-main daemon-or-C/C++ thread forever that 
is guaranteed to not acquire the GIL because the Python interpreter is going 
away is the right default behavior instead of blindly killing it under the 
unsupportable assumption that it has nothing to clean up: We can proceed with 
such a callback API. I'm having a hard time imagining any other behavior that 
makes sense, so I'd expect lots of Python extension interface code to start 
carrying a copy of an implementation of a hang callback and sporting a 
Py_SetThreadExitCallback(xxx) call in their module Init function. (especially 
if pybind11 finds needs to generate this as boilerplate)

I think the pthread_exit() call added in issue1856's 
https://hg.python.org/cpython/rev/c892b0321d23 were well intentioned, but not 
aware of the full unsupportable ramifications of that API call. That the 
attempt at releasing a backport of the pthread_exit call to 2.7.8 broke an 
application (that was admittedly doing something unwise) and had to be reverted 
as 2.7.9 was a sign for us to revisit this in 3.x releases as well.  Which 
we're finally doing here.

--
nosy: +pitrou

___
Python tracker 

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



[issue45280] Empty typing.NamedTuple creation is not tested

2021-09-25 Thread Nikita Sobolev


Change by Nikita Sobolev :


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

___
Python tracker 

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



[issue45275] Make argparse print description of subcommand when invoke help doc on subcommand

2021-09-25 Thread Nikita Sobolev


Nikita Sobolev  added the comment:

Hi!

>From your description it is not clear how exactly you create your subcommand.

>From my experience, it works. Demo:

```
import argparse

parser = argparse.ArgumentParser(description='Process some integers.')
subparsers = parser.add_subparsers()

# create the parser for the "a" command
parser_a = subparsers.add_parser('a', help='a help', description='test me')
parser_a.add_argument('bar', type=int, help='bar help')

print(parser.parse_args())
```

Here's the output of `python script.py a -h`:

```
usage: ex.py a [-h] bar

test me

positional arguments:
  bar bar help

options:
  -h, --help  show this help message and exit
```

Do you have the same setup? Or is there anything else that needs to be fixed?

--
nosy: +sobolevn

___
Python tracker 

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



[issue45113] [subinterpreters][C API] Add a new function to create PyStructSequence from Heap.

2021-09-25 Thread Hai Shi


Hai Shi  added the comment:

> More generally, this would need solving one of the remaining limitations of 
> the limited API (PEPs 489, 630): type-specific data.
Agree. We can't track and destroy the memory block created from the heap now.

--

___
Python tracker 

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