Re: dayofyear is not great when going into a new year

2021-01-08 Thread Christian Gollwitzer

Am 05.01.21 um 23:56 schrieb Eli the Bearded:

Elijah
--
also finds "week starts on Monday" to be oddball about ISO-8601



In Europe, the week starts on Monday - hence, Saturday and Sunday are 
the last days of the week or the "weekend". Starting on Sunday is weird 
for us, because then the weekend is split into the first and last day of 
the week (?) - even if, historically, the week was the time from Sunday 
to Sunday.



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


Re: better handling of "pinned" modules?

2021-01-08 Thread Andrew Jaffe

On 08/01/2021 18:21, Chris Angelico wrote:

On Sat, Jan 9, 2021 at 5:18 AM Andrew Jaffe  wrote:


Hi,

I don't know if this makes more sense here or on "python-ideas" (or
elsewhere?) but I'll try this first:

I am starting to encounter more and more instances of packages requiring
older, pinned, versions of modules, and this is occasionally actually
starting to cause conflicts.



The first thing to do is to see if those packages ACTUALLY need older
versions of those dependencies. There's a good chance they don't.

To avoid creating this sort of problem, don't depend on a highly
specific version of things; just depend on a minimum version, and if
there's a problem (ONLY if there's a problem), a maximum version.


Well, sure. But there's still the "aesthetic" problem that `pip[3] 
check` reports a problem in such a case, and the real (albeit 
correctable) problem that `pip[3] install --upgrade` will occasionally 
automatically downgrade required packages.


So perhaps my original query about whether there could be a way to 
actually solve this problem is still potentially interesting/useful.


AndrewJ


ChrisA




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


[issue42850] Process hangs when calling urllib.request in a multiprocessing.Process with import of sounddevice package

2021-01-08 Thread Robin Scheibler


Robin Scheibler  added the comment:

Thanks for the suggestion. I had indeed run into some issues with fork vs spawn 
before.

I have tested with 3.8.5 and 3.9.1 and the bug doesn't occur with these more 
recent versions.

Should I leave the bug open since 3.7 is still supported ?

--

___
Python tracker 

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



Re: Remove duplicate values from dictionary without removing key

2021-01-08 Thread Louis Krupp

On 1/8/2021 2:56 AM, Umar Draz wrote:

I want to replace duplicate values with empty "" in my dictionary. Here is
my original dictionary.

items = [
 {'client': 'xyz', 'name': "Ilir Meta", 'rating': 0.06, 'total': 100},
 {'client': 'xyz','name': "Abdelmadjid Tebboune", 'rating': 4.0,
'total': 100},
 {'client': 'xyz','name': "Alexander Lukashenko", 'rating': 3.1,
'total': 100},
 {'client': 'xyz', 'name': "Miguel Díaz-Canel", 'rating': 0.32,
'total': 100},
 {'client': 'udz', 'name': "Ilir Meta", 'rating': 0.06, 'total': 150},
 {'client': 'udz', 'name': "Abdelmadjid Tebboune", 'rating': 4.0,
'total': 100},
 {'client': 'udz', 'name': "Alexander Lukashenko", 'rating': 3.1,
'total': 150},
 {'client': 'udz', 'name': "Miguel Díaz-Canel", 'rating': 0.32, 'total': 
150}
]


Now I want to create another dict with like this

items = [
 {'client': 'xyz', 'name': "Ilir Meta", 'rating': 0.06, 'total': 100},
 {'client': '','name': "Abdelmadjid Tebboune", 'rating': 4.0, 'total': ''},
 {'client': '','name': "Alexander Lukashenko", 'rating': 3.1, 'total': ''},
 {'client': '', 'name': "Miguel Díaz-Canel", 'rating': 0.32, 'total': ''},
 {'client': 'udz', 'name': "Ilir Meta", 'rating': 0.06, 'total': 150},
 {'client': '', 'name': "Abdelmadjid Tebboune", 'rating': 4.0, 'total': ''},
 {'client': '', 'name': "Alexander Lukashenko", 'rating': 3.1, 'total': ''},
 {'client': '', 'name': "Miguel Díaz-Canel", 'rating': 0.32, 'total': ''}
]


Would you please help me how I can do this? and if this is not the right
place to ask this question then please help me where I can ask this? I had
tried stackoverflow but that not worked.


items isn't a dictionary; as MRAB mentioned, it's a list of 
dictionaries. Each dictionary in items looks like a database record with 
fields (client, name, rating, and total).


When you say you want to replace duplicate client fields by "", it 
almost looks like you're getting ready to print a report that looks 
something like this:


xyz    Ilir Meta  0.06    100
  Abdelmadjid Tebboune    4.00    100
  Alexander Lukashenko 3.10
...

where the report will look better when duplicate client values aren't 
printed.


If that's the case, there are almost certainly better ways to do it. 
Changing values in items might have unforeseen consequences, since once 
duplicate client fields have been wiped out, there's no way to retrieve 
items[1]["client"] without looking at items[0]. And if the list of items 
is ever reordered, some of the client fields will be lost for good.


I hope this helps.

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


[issue42800] Traceback objects allow accessing frame objects without triggering audit hooks

2021-01-08 Thread Ryan Hileman


Ryan Hileman  added the comment:

Oops, by tb_code I meant traceback.tb_frame.f_code. So you can get to a frame 
from traceback.tb_frame (without triggering audit) or sys._getframe (which has 
an audit hook already), and you can get to __code__ from a frame via 
frame.f_code (without triggering audit).

Here's a patch for both frame.f_code and traceback.tb_frame:
https://github.com/lunixbochs/cpython/commit/2334a00c833874b7a2427e88abc9b51315bb010c

---

Benchmarks follow this section, made using the commit I linked (and the parent 
commit without the patch for comparison). My takeaways from playing around:

1. You probably shouldn't install a Python audit hook if you care about 
performance.
2. C audit hook performance impact shows up in microbenchmarking but only have 
a small impact on real workloads (see the traceback.format_tb benchmark at the 
end).
3. Performance impact of this change when you _don't_ have an audit hook 
installed is very small.
4. This seems to mostly impact debugging and test code. A quick check of the 
stdlib shows:
- traceback.tb_frame usage seems to be entirely in debugger, traceback, and 
testing code: https://github.com/python/cpython/search?l=Python=3=tb_frame
- frame.f_code primarily has similar debug use (dis, warnings, profiling, 
inspect): https://github.com/python/cpython/search?l=Python=3=f_code

Attached (c_audit_ext.zip) is the empty C audit hook I used for the benchmarks. 
`python3 setup.py build_ext` builds a `c_audit` module which registers an empty 
audit hook on import.


 frame.f_code object.__getattr__ audit hook

# Testing frame.f_code impact (no audit hook installed):
./python.exe -m timeit -s 'frame = sys._getframe()' -- 'frame.f_code'

with patch 2334a00c833874b7a2427e88abc9b51315bb010c
2000 loops, best of 5: 19.1 nsec per loop
2000 loops, best of 5: 18.7 nsec per loop
2000 loops, best of 5: 19.1 nsec per loop

without patch 2334a00c833874b7a2427e88abc9b51315bb010c
2000 loops, best of 5: 17 nsec per loop
2000 loops, best of 5: 16.7 nsec per loop
2000 loops, best of 5: 17 nsec per loop

# Testing frame.f_code impact (C audit hook installed):
python.exe -m timeit -s 'import c_audit; frame = sys._getframe()' -- 
'frame.f_code'

with patch 2334a00c833874b7a2427e88abc9b51315bb010c
500 loops, best of 5: 66.1 nsec per loop
500 loops, best of 5: 66.1 nsec per loop
500 loops, best of 5: 66.5 nsec per loop

without patch 2334a00c833874b7a2427e88abc9b51315bb010c
2000 loops, best of 5: 16.9 nsec per loop
2000 loops, best of 5: 16.9 nsec per loop
2000 loops, best of 5: 16.8 nsec per loop

# Testing frame.f_code impact (pure Python audit hook installed):
./python.exe -m timeit -s 'frame = sys._getframe(); sys.addaudithook(lambda *a: 
None)' -- 'frame.f_code'

with patch 2334a00c833874b7a2427e88abc9b51315bb010c
50 loops, best of 5: 1.02 usec per loop
50 loops, best of 5: 1.04 usec per loop
50 loops, best of 5: 1.02 usec per loop

without patch 2334a00c833874b7a2427e88abc9b51315bb010c
2000 loops, best of 5: 16.8 nsec per loop
2000 loops, best of 5: 17.1 nsec per loop
2000 loops, best of 5: 16.8 nsec per loop


 tb.tb_frame object.__getattr__ audit hook

# Testing tb.tb_frame impact (no audit hook installed)
./python.exe -m timeit -s "$(echo -e "try: a\nexcept Exception as e: tb = 
e.__traceback__")" -- 'tb.tb_frame'

with patch 2334a00c833874b7a2427e88abc9b51315bb010c
2000 loops, best of 5: 19.2 nsec per loop
2000 loops, best of 5: 18.9 nsec per loop
2000 loops, best of 5: 18.9 nsec per loop

without patch 2334a00c833874b7a2427e88abc9b51315bb010c
2000 loops, best of 5: 17 nsec per loop
2000 loops, best of 5: 16.7 nsec per loop
2000 loops, best of 5: 16.8 nsec per loop

# Testing tb.tb_frame impact (C audit hook installed)
./python.exe -m timeit -s "$(echo -e "import c_audit\ntry: a\nexcept Exception 
as e: tb = e.__traceback__")" -- 'tb.tb_frame'

with patch 2334a00c833874b7a2427e88abc9b51315bb010c
500 loops, best of 5: 64.8 nsec per loop
500 loops, best of 5: 64.8 nsec per loop
500 loops, best of 5: 64.8 nsec per loop

without patch 2334a00c833874b7a2427e88abc9b51315bb010c
2000 loops, best of 5: 16.7 nsec per loop
2000 loops, best of 5: 16.9 nsec per loop
2000 loops, best of 5: 16.9 nsec per loop

# Testing tb.tb_frame impact (pure Python audit hook installed)
./python.exe -m timeit -s "$(echo -e "sys.addaudithook(lambda *a: None)\ntry: 
a\nexcept Exception as e: tb = e.__traceback__")" -- 'tb.tb_frame'

with patch 2334a00c833874b7a2427e88abc9b51315bb010c
50 loops, best of 5: 1.04 usec per loop
50 loops, best of 5: 1.02 usec per loop
50 loops, best of 5: 1.04 usec per loop

without patch 2334a00c833874b7a2427e88abc9b51315bb010c
2000 loops, best of 5: 16.9 nsec per loop

[issue42871] Regex compilation crashed if I change order of alternatives under quantifier

2021-01-08 Thread Renji


Renji  added the comment:

I through "forward reference" is "\1 (abcd)". Not "some sort of reference in 
second repetition to data from first repetition".

Ok. In other words refers from on repetition to other supported, but with 
purely formal restrictions. And remove this restrictions don't planned. Than 
this issue may be closed.

--

___
Python tracker 

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



[issue42871] Regex compilation crashed if I change order of alternatives under quantifier

2021-01-08 Thread Matthew Barnett


Matthew Barnett  added the comment:

Example 1:

((a)|b\2)*
 ^^^   Group 2

((a)|b\2)*
  ^^   Reference to group 2

The reference refers backwards to the group.

Example 2:

(b\2|(a))*
 ^^^   Group 2

(b\2|(a))*
  ^^   Reference to group 2

The reference refers forwards to the group.

As I said, the re module doesn't support forward references to groups.

If you have a regex where forward references are unavoidable, try the 3rd-party 
'regex' module instead. It's available on PyPI.

--

___
Python tracker 

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



[issue42800] Traceback objects allow accessing frame objects without triggering audit hooks

2021-01-08 Thread Ryan Hileman


Ryan Hileman  added the comment:

I'm definitely not proposing to hook all of object.__getattr__, as my intuition 
says that would be very slow. I simply refer to "object.__getattr__" as the 
event name used by a couple of rare event audit hooks. This is how getting 
__code__ is emitted: 
https://github.com/python/cpython/blob/7301979b23406220510dd2c7934a21b41b647119/Objects/funcobject.c#L250

However, there's not much point in the sys._getframe and func.__code__ family 
of audit hooks right now as tracebacks expose the same information (and may 
even do so accidentally). I am personally interested in these hooks for non 
sandbox reasons in a production application that cares about perf, FWIW.

I think this would be implemented by extending the traceback object's getters 
to include tb_code and tb_frame: 
https://github.com/python/cpython/blob/7301979b23406220510dd2c7934a21b41b647119/Python/traceback.c#L156-L159

I project it won't have any noticeable perf impact (especially if the audit 
hook is written in C), as most reasons to inspect a traceback object will be 
exceptional and not in critical paths.

I'd be happy to write a proposed patch if that would help.

--

___
Python tracker 

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



[issue42871] Regex compilation crashed if I change order of alternatives under quantifier

2021-01-08 Thread Renji


Renji  added the comment:

In my example reference and capture group presents in two difference 
alternatives. They don't follow each other, but executed in random order. If 
this don't supported in one case, why it supported in other case?

--

___
Python tracker 

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



[issue42871] Regex compilation crashed if I change order of alternatives under quantifier

2021-01-08 Thread Matthew Barnett


Matthew Barnett  added the comment:

It's not a crash. It's complaining that you're referring to group 2 before 
defining it. The re module doesn't support forward references to groups, but 
only backward references to them.

--

___
Python tracker 

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



[issue42840] `type` takes **kwargs for __init_subclass__

2021-01-08 Thread Erik Soma


Erik Soma  added the comment:

Seems I misframed the issue a bit. I didn't realize keyword arguments besides 
'metaclass' were introduced with PEP 3115 with Python 3.0.


In any case I've posted a PR to update the docs and typeshed.
Typeshed PR for reference: https://github.com/python/typeshed/pull/4918

--

___
Python tracker 

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



[issue42800] Traceback objects allow accessing frame objects without triggering audit hooks

2021-01-08 Thread STINNER Victor


STINNER Victor  added the comment:

Even if no audit hook is registered, adding an audit event on a function has a 
cost on runtime performance. object.__getattr__() is a core Python function, if 
an event is added, we should properly measure the performance overhead to 
decide if it's acceptable or not.

--

___
Python tracker 

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



[issue42800] Traceback objects allow accessing frame objects without triggering audit hooks

2021-01-08 Thread STINNER Victor


STINNER Victor  added the comment:

I don't think that audit hooks should be seen as a way to build a robust 
sandbox.
https://www.python.org/dev/peps/pep-0578/#why-not-a-sandbox

--

___
Python tracker 

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



[issue42800] Traceback objects allow accessing frame objects without triggering audit hooks

2021-01-08 Thread STINNER Victor


Change by STINNER Victor :


--
nosy: +vstinner

___
Python tracker 

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



Re: learning python building 2nd app, need advices

2021-01-08 Thread Richard Damon
On 1/8/21 6:10 PM, pascal z via Python-list wrote:
> any way to attach a file because I loose indentation?

Don't post via googlegroups, it thinks the world is HTML, which treats
spaces in a funny matter.

-- 
Richard Damon

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


[issue42800] Traceback objects allow accessing frame objects without triggering audit hooks

2021-01-08 Thread Ryan Hileman


Ryan Hileman  added the comment:

traceback's `tb_code` attribute also allows you to bypass the 
`object.__getattr__` audit event for `__code__`.

Perhaps accessing a traceback object's `tb_code` and `tb_frame` should both 
raise an `object.__getattr__` event?

--
nosy: +lunixbochs2

___
Python tracker 

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



[issue42871] Regex compilation crashed if I change order of alternatives under quantifier

2021-01-08 Thread Renji


New submission from Renji :

I can compile "((a)|b\2)*" expression and this expression successfully return 
captures from first repetition and second repetition in one time. But if I 
write (b\2|(a))* expression, I get "invalid group reference 2 at position 3" 
error. Either first or second behavior incorrect.
python3 --version Python 3.7.3

import re
text="aba"
#match=re.search(r"(b\2|(a))*",text) - not worked
match=re.search(r"((a)|b\2)*",text)
if(match):
#show aba ba a
print(match.group(0)+" "+match.group(1)+" "+match.group(2))

--
components: Regular Expressions
messages: 384703
nosy: Renji, ezio.melotti, mrabarnett
priority: normal
severity: normal
status: open
title: Regex compilation crashed if I change order of alternatives under 
quantifier
type: behavior
versions: Python 3.7

___
Python tracker 

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



[issue42867] Entry Widget not editable on Windows 10, but is on Linux Ubuntu 16.04

2021-01-08 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

I added this note to #9673 after rereading the posts and the 2010 tkinter list 
thread.

"My testing was inadequate.  From #42867, it appears that 0. the bug is limited 
to Windows; 1. opening a canned dialog or message box is part of getting the 
buggy behavior; 2. timing is involved; 3. the bug can be exhibited on Windows 
directly with wish/tk, so that it is a 3rd party tcl/tk issue and not a tkinter 
issue.  Hence changing the issue resolution.

A workaround mentioned in both the referenced tkinter thread and #42867 is to 
call after_idle() at some point."

Paine, thank you for verifying both the bug and workaround directly with tk.  I 
am closing this also as 3rd party.

--
resolution:  -> third party
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



Re: learning python building 2nd app, need advices

2021-01-08 Thread Greg Ewing

On 9/01/21 12:10 pm, pascal z wrote:

any way to attach a file because I loose indentation?


Indentation usually makes it through here if you indent with
spaces rather than tabs.

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


[issue9673] Entry Widget Not Editable under Windows XP with dialog call.

2021-01-08 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

My testing was inadequate.  From #42867, it appears that 0. the bug is limited 
to Windows; 1. opening a canned dialog or message box is part of getting the 
buggy behavior; 2. timing is involved; 3. the bug can be exhibited on Windows 
directly with wish/tk, so that it is a 3rd party tcl/tk issue and not a tkinter 
issue.  Hence changing the issue resolution.

A workaround mentioned in both the referenced tkinter thread and #42867 is to 
call after_idle() at some point.

--
resolution: out of date -> third party
title: Entry Widget Not Editable under Windows XP -> Entry Widget Not Editable 
under Windows XP with dialog call.

___
Python tracker 

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



[issue9694] argparse required arguments displayed under "optional arguments"

2021-01-08 Thread Miro Hrončok

Miro Hrončok  added the comment:

https://bugs.python.org/issue42870

--

___
Python tracker 

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



[issue42870] Document changed argparse output wrt optional arguments in What's new in Python 3.10

2021-01-08 Thread Miro Hrončok

New submission from Miro Hrončok :

A followup from https://bugs.python.org/issue9694

Could the change in output please be mentioned on 
https://docs.python.org/3.10/whatsnew/3.10.html ?

In Fedora, at least 3 packages fail tests because of the change:

ipython: https://github.com/ipython/ipython/pull/12759
m2r: https://github.com/miyakogi/m2r/pull/62
sphinxcontrib-autoprogram: https://bugzilla.redhat.com/show_bug.cgi?id=1914341

Thanks.

--
assignee: docs@python
components: Documentation
messages: 384699
nosy: docs@python, hroncok, paul.j3, rhettinger
priority: normal
severity: normal
status: open
title: Document changed argparse output wrt optional arguments in What's new in 
Python 3.10
versions: Python 3.10

___
Python tracker 

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



[issue42849] pool worker can't be terminated

2021-01-08 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

3.7 has not gotten bug fixes for a couple of years.  This needs to be verified 
on a current release.

--
nosy: +davin, pitrou, terry.reedy

___
Python tracker 

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



[issue42802] distutils: Remove bdist_wininst command

2021-01-08 Thread STINNER Victor


Change by STINNER Victor :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



[issue42820] Sphinx conf.py needs_version entry is outdated

2021-01-08 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

This is related to #42843, which is about deciding what the min sphinx should 
be.  Since the alternative to 3.2 is some 2.x, 1,8 is certainly wrong.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue42802] distutils: Remove bdist_wininst command

2021-01-08 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 0e2a0f72cc9af0899eacb5604e44a563c0b06110 by Victor Stinner in 
branch 'master':
bpo-42802: Remove distutils bdist_wininst command (GH-24043)
https://github.com/python/cpython/commit/0e2a0f72cc9af0899eacb5604e44a563c0b06110


--

___
Python tracker 

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



[issue42825] Build libraries with "/OPT:REF" linker optimization on Windows

2021-01-08 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

The PR says that this deletes "uncalled code".  I imagine that this is safe for 
a .exe.  But for a .dll?  As i understand it, one can, from python code, access 
any function via ctypes, so it seems to me that there is no way for the linker 
to know which callable functions in a .dll can be safely deleted.  Am I missing 
something?

--
nosy: +terry.reedy

___
Python tracker 

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



Re: learning python building 2nd app, need advices

2021-01-08 Thread pascal z via Python-list
And something important to this app, is about listing files, how to avoid 
listing small application files parts .ini and binary files so if it's an 
application it would tell the size of of the folder of this application and not 
list the content or make it optionnal?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: tkinter: creating/attaching menubar to top level window

2021-01-08 Thread Rich Shepard

On Fri, 8 Jan 2021, Richard Damon wrote:


It could be either:
self.menu = menubar
or
self['menu'] = menubar


Got it, Richard. Removed the period after 'self'.

Thanks,

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


Re: tkinter: creating/attaching menubar to top level window [RESOLVED]

2021-01-08 Thread Rich Shepard

On Fri, 8 Jan 2021, Christian Gollwitzer wrote:


It is a simple typo, remove the dot.
self['menu'] = menubar
It will then stop at the add_cascade, fix it like this:


Christian,

Well, I totally missed that because I'm used to adding a period after each
self. Your fresh eyes saw what I kept missing,


menubar.add_cascade(menu=self.menu_file, label='File')


I was going to add the 'self' there when I found what stopped the processing
before it.

Many thanks.

Stay well and carpe weekend,

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


Re: learning python building 2nd app, need advices

2021-01-08 Thread pascal z via Python-list
any way to attach a file because I loose indentation?
-- 
https://mail.python.org/mailman/listinfo/python-list


learning python building 2nd app, need advices

2021-01-08 Thread pascal z via Python-list
Hi,

This is a python app I was working on, can you help making it a beautiful 
looking app like bleachbit or ccleaner?

The whole code below (what it does: it lists all folders and files from a 
specified path and tells some infos like size in mb or gb... and export it to a 
csv file for further processing maybe with customized dashboard...the listing 
should will also be used to rename multiple files to help ordering and finding 
files because current renaming tools are difficult to use I find...) For now it 
just gives infos about folders and files and rename. Maybe a backup tool would 
be nice, please advise. But the code is opposiite to bullet proof and if could 
be more bullet proof, it would be a way to start and continue

the messy code

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import locale
import os
import csv
from tkinter import messagebox as msg

try:
from tkinter import *
import ttk
except:
import tkinter as tk #GUI package
from tkinter import ttk


def fx_BasicListing():
#argx mode = 1 pour basic listing
#argx mode = 2 pour adv listing
# "txt" pour type enreg csv txt/csv
# tree.delete(*tree.get_children())
fx_browseFoldersZ(1)
return

def fx_AdvancedListing():
#argx mode = 1 pour basic listing
#argx mode = 2 pour adv listing
# fx_browseFoldersZ(2,"txt")
# tree.destroy()
#tree.delete(*tree.get_children())
fx_browseFoldersZ(2)
return

def fx_browseFoldersZ(argy):
#argx mode = 1 pour basic listing
#argx mode = 2 pour adv listing
# "txt" pour type enreg csv txt/csv
tree.delete(*tree.get_children())
fx_browseFolders(argy,"txt")

###
###
###

def fx_writeCSV(*arr):

csv_file_title = 'csv_1_baselisting.csv'
# csv path entry box
CSV_FILE = vcsv_path.get()

if not os.path.exists(CSV_FILE):
os.makedirs(CSV_FILE)

CSV_FILE += csv_file_title
print('%s' % CSV_FILE)

with open(CSV_FILE,'w', newline ='\n') as f:
write = csv.writer(f, doublequote=True, delimiter=';')
for row in arr:
write.writerows(row)

def fx_writeCSV_str(txt_str):
csv_file_title = 'csvtxt_1_baselisting.csv'
# csv path entry box
CSV_FILE = vcsv_path.get()

if not os.path.exists(CSV_FILE):
os.makedirs(CSV_FILE)

CSV_FILE += csv_file_title
print('%s' % CSV_FILE)

with open(CSV_FILE,'w') as f:
f.write(txt_str)

# fx_LoadCSV(CSV_FILE)

with open(CSV_FILE, 'r') as f:
reader = csv.DictReader(f, delimiter=';')
for row in reader:
col1 = row['Path']
col2 = row['Folder-file']
col3 = row['Size in Byte']
col4 = row['Size in Kb']
col5 = row['Size in Mb']
col6 = row['Size in Gb']
col7 = row['type']

tree.insert('', 'end', values=(col1, col2, col3, col4, col5, 
col6,col7))

return

###
###

def fx_chkPath(xzPath):
isxFile = os.path.isfile(xzPath)
isxDir = os.path.isdir(xzPath)
print("DOSSIER OUI",isxDir)
if isxDir:
return
elif not isxDir:
msg.showwarning("Folder path", "WD Path entered not found")
return


###
###
###


def fx_browseFolders(argz, tycsv):
tree.delete(*tree.get_children())
# /// /// ///
csv_txt = ""
csv_contents = ""
counterPath = 0
size = 0
f_size = 0
f_vscale = 0
# /// /// ///

# path WD
Lpath = vtxt_path.get()
print('%s' % Lpath)

# include files
vvchkboxF = vchkboxF.get()
# print("include files:::", vchkboxF.get())

# include modification date
print(vchkboxD.get())

# include creation date
print(vchkboxC.get())

# scale
f_vscale = int(var_scale.get())
print(f_vscale)

# path WD 2
if Lpath.endswith(os.path.sep):
   Lpath = Lpath[:-1]

# isFile = os.path.isfile(Lpath)
# print("fichier?",isFile)
fx_chkPath(Lpath)

counterPath = Lpath.count(os.path.sep)

csv_contents = "Path;Folder-file;Size in Byte;Size in Kb;Size in Mb;Size in 
Gb;type\n"

csv_txt = csv_contents

# csv_contents
# 1-FOLDER PATH
# 2-FILENAME
# 3-FOLDER PATH FULL
# 4-Size in Byte
# 5-Size in Kb
# 6-Size in Mb
# 7-Size in Gb
# 8-type\n

### BASIC LISTING #
if argz == 1:
print("basic listing")

[issue42820] Sphinx conf.py needs_version entry is outdated

2021-01-08 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
nosy: +mdk

___
Python tracker 

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



[issue1635741] Py_Finalize() doesn't clear all Python objects at exit

2021-01-08 Thread Erlend Egeberg Aasland


Change by Erlend Egeberg Aasland :


--
pull_requests: +23002
pull_request: https://github.com/python/cpython/pull/24175

___
Python tracker 

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



Re: dayofyear is not great when going into a new year

2021-01-08 Thread Greg Ewing

On 9/01/21 11:17 am, Martin Schöön wrote:

"regardless of what you have been told, recreational use of
mathematics is harmless"

I hope that is true for recreational programming as well :-)


Mostly harmless, but it can be addictive!

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


Re: dayofyear is not great when going into a new year

2021-01-08 Thread Martin Schöön
Den 2021-01-05 skrev Stefan Ram :
> Martin =?UTF-8?Q?Sch=C3=B6=C3=B6n?=  writes:
>>I have had some Python fun with COVID-19 data. I have done
>>some curve fitting and to make that easier I have transformed
>>date to day of year. Come end of 2020 and beginning of 2021
>>and this idea falls on its face.
>
> import datetime
>
> continuous_day_of_the_year = \
> ( datetime.date.today() - datetime.date( 2020, 1, 1 )).days
>
>
Thanks guys, you got me on the right track. After some further
meandering I did something close to what Stefan suggest above.
I added a column to my Pandas data frame and populated it with

content of date column - datetime(2020, 1, 1)

"regardless of what you have been told, recreational use of
mathematics is harmless"

I hope that is true for recreational programming as well :-)

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


Re: tkinter: creating/attaching menubar to top level window

2021-01-08 Thread Richard Damon
On 1/8/21 4:47 PM, Rich Shepard wrote:
> I'm using Chapter 9 in Mark Roseman's "Modern Tkinter for Busy Python
> Developers" to learn how to write a top level menu. MWE code is attached.
>
> Python3 tells me there's invalid syntax on line 42:
>     self.['menu'] = menubar # attach it to the top level window
>  ^
> yet that's the syntax he prints on page 84 (and has in the book's code
> supplement).
>
> Why am I getting an invalid syntax error here?
>
> TIA,
>
> Rich 


Because it is the wrong syntax.

It could be either:

self.menu = menubar

or

self['menu'] = menubar

-- 
Richard Damon

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


Re: tkinter: creating/attaching menubar to top level window

2021-01-08 Thread Christian Gollwitzer

Am 08.01.21 um 22:47 schrieb Rich Shepard:

I'm using Chapter 9 in Mark Roseman's "Modern Tkinter for Busy Python
Developers" to learn how to write a top level menu. MWE code is attached.

Python3 tells me there's invalid syntax on line 42:
     self.['menu'] = menubar # attach it to the top level window
  ^
yet that's the syntax he prints on page 84 (and has in the book's code
supplement).


It is a simple typo, remove the dot.

self['menu'] = menubar

It will then stop at the add_cascade, fix it like this:

 menubar.add_cascade(menu=self.menu_file, label='File')

and then it works,


Why am I getting an invalid syntax error here?


Because the dot would indicate the access of an attribute. but no name 
follows. What it does here, instead, is indexing - the correct line is 
similar to setting a dict entry.


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


[issue42869] pydoc does not append .html to documentation

2021-01-08 Thread Julien Palard


Julien Palard  added the comment:

This is now fixed on the docs server thanks to [1], so it should work for 
already release Python 3.9 :)

[1]: https://github.com/python/psf-salt/pull/198

I still did a PR on cpython to avoid a redirection, and get cpython itself out 
of the "people use this temporary fix as a feature now".

--

___
Python tracker 

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



[issue42869] pydoc does not append .html to documentation

2021-01-08 Thread Julien Palard


Change by Julien Palard :


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

___
Python tracker 

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



[issue42869] pydoc does not append .html to documentation

2021-01-08 Thread Julien Palard


New submission from Julien Palard :

Running `python3 -m pydoc ensurepip` gives me:

https://docs.python.org/3.9/library/ensurepip
but it should be:

https://docs.python.org/3.9/library/ensurepip.html

Issue is in getdocloc function on the line:

docloc = "%s/%s" % (docloc.rstrip("/"), object.__name__.lower())

But it previously worked as the nginx config for the doc server contains:

# Emulate Apache's content-negotiation. Was a temporary measure,
# but now people are using it like a feature.
location ~ ^/((2|3)(\.[0-8])?|dev)/\w+/[\d\w\.]+(?!\.html)$ {
if (-f "${request_filename}.html") {
return 301 https://$host:$request_uri.html;
}
}

(So yes "people are using it like a feature" contains pydoc :))

Notice the [0-8], which does not match for my /3.9/.

I propose to fix the issue on both sides:
- On psf-salt to allow 3.9 to get the "temporary" measure.
- pydoc side to simplify the code

--
assignee: docs@python
components: Documentation
messages: 384693
nosy: docs@python, mdk
priority: normal
severity: normal
status: open
title: pydoc does not append .html to documentation
versions: Python 3.9

___
Python tracker 

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



tkinter: creating/attaching menubar to top level window

2021-01-08 Thread Rich Shepard

I'm using Chapter 9 in Mark Roseman's "Modern Tkinter for Busy Python
Developers" to learn how to write a top level menu. MWE code is attached.

Python3 tells me there's invalid syntax on line 42:
self.['menu'] = menubar # attach it to the top level window
 ^
yet that's the syntax he prints on page 84 (and has in the book's code
supplement).

Why am I getting an invalid syntax error here?

TIA,

Rich
#!/usr/bin/env python3

# main file to start application.
from os import environ
import sys
import pdb
from datetime import datetime
import tkinter as tk
from tkinter import ttk
from tkinter import Menu
from tkinter import filedialog
from tkinter import messagebox
from tkinter.font import nametofont
from functools import partial
import model as m
import views as v
import controller as c


class Application(tk.Tk):
""" Application root window """

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

# the top level frame holding menu, status bar, etc.
self.columnconfigure(0, weight=1)
self.rowconfigure(0, weight=1)
self.geometry('800x600')
self.title("Frame title")
self.resizable(width=True, height=True)

datestring = datetime.today().strftime("%Y-%m-%d")

# status bar
self.status = tk.StringVar()
self.statusbar = ttk.Label(self, textvariable=self.status)
self.statusbar.grid(sticky="we", row=3, padx=10)

# toplevel window menu
menubar = Menu(self) # create a Menu widget
self.['menu'] = menubar # attach it to the top level window
""" Add menus to menubar """
self.menu_file = Menu(menubar, tearoff=0)
self.menu_view = Menu(menubar, tearoff=0)
self.menu_add = Menu(menubar, tearoff=0)
self.menu_edit = Menu(menubar, tearoff=0)
self.menu_report = Menu(menubar, tearoff=0)
self.menu_help = Menu(menubar, tearoff=0)
""" Add menu items to menus """
menubar.add_cascade(menu_file, label='File')
menubar.add_cascade(menu_view, label='View')
menubar.add_cascade(menu_add, label='Add')
menubar.add_cascade(menu_edit, label='Edit')
menubar.add_cascade(menu_report, label='Report')
menubar.add_cascade(menu_help, label='Help')

if __name__ == "__main__":
app = Application()
app.mainloop()
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue42812] @overload-ing method of parent class without actual implementation

2021-01-08 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
nosy: +gvanrossum, levkivskyi

___
Python tracker 

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



[issue42807] smtplib send_message should gives more clear exception if the msg is None

2021-01-08 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

I am not familiar with either smtp or email, but I can make some general 
comments.

1. "AttributeError: 'NoneType' object has no attribute 'get_all'" seems pretty 
straightforward to me.  Hard to debug?  Depends on knowledge and experience. 
When coming from library code, it nearly always means that one called a library 
function with an invalid argument.  None, with only standard dunder attributes, 
is perhaps the most common bad argument.  Look in the traceback to find the bad 
call in one's own code, where one must have passed None, even if not by that 
name.  In this case, if one does not know that 'get_all' is a method of the two 
email message classes, this can be discovered in the document index.

2. It is not a bug for a function to expect users to know the above and in 
effect say "Don't do that!" when an attribute reference fails.  So I see this 
as an enhancement request, not a bugfix report.  But why add a check for None 
to this particular function?

3. Python functions often use duck-typing, allowing arguments that act 
sufficiently well like the documented requirement.  While 
https://docs.python.org/3/library/smtplib.html#smtplib.SMTP.send_message  says 
that msg should be a Message object, this may not be an exact requirement.  
Indeed, 
https://docs.python.org/3/library/smtplib.html#smtplib.SMTP.send_message starts 
with "The Message class is very similar to the EmailMessage class ...".  So I 
wonder, "Is EmailMessage is also allowed?"  Or, "Do  any users pass instances 
of custom message classes?"

If so, perhaps the doc should be augmented.  But checking only for Message 
would be wrong, and would break code passing non-Message instances.

--
nosy: +barry, maxking, r.david.murray, terry.reedy
stage:  -> test needed
type: behavior -> enhancement

___
Python tracker 

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



[issue42862] Use functools.lru_cache iso. _sqlite.Cache in sqlite3 module

2021-01-08 Thread Erlend Egeberg Aasland


Erlend Egeberg Aasland  added the comment:

$ python3.10 -m timeit -s 'import sqlite3; con = sqlite3.connect(":memory:"); 
query="select * from sqlite_master"' 'con.execute(query); con.execute(query)'
10 loops, best of 5: 2.95 usec per loop
$ ./python.exe -m timeit -s 'import sqlite3; con = sqlite3.connect(":memory:"); 
query="select * from sqlite_master"' 'con.execute(query); con.execute(query)'
10 loops, best of 5: 2.68 usec per loop

--

___
Python tracker 

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



[issue42840] `type` takes **kwargs for __init_subclass__

2021-01-08 Thread Erik Soma


Change by Erik Soma :


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

___
Python tracker 

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



[issue42780] os.set_inheritable() fails for O_PATH file descriptors on Linux

2021-01-08 Thread cptpcrd


Change by cptpcrd :


--
pull_requests: +22999
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/24172

___
Python tracker 

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



[issue42269] Add ability to set __slots__ in dataclasses

2021-01-08 Thread Yurii Karabas


Yurii Karabas <1998uri...@gmail.com> added the comment:

Hi Eric, I tried to help you with this feature and have opened a PR. I thought 
that you are too busy to implement this feature, so that's why I decided to 
help you (It almost two months since your last message in this thread).

--

___
Python tracker 

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



[issue42269] Add ability to set __slots__ in dataclasses

2021-01-08 Thread Yurii Karabas


Change by Yurii Karabas <1998uri...@gmail.com>:


--
keywords: +patch
nosy: +uriyyo
nosy_count: 5.0 -> 6.0
pull_requests: +22998
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/24171

___
Python tracker 

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



Asyncio project code review

2021-01-08 Thread James

Good day for everyone.

I have new asyncio project which use aiohttp connector and asyncio 
protocols/transports for tunneling packets through Tor Network cleanly. 
Project called aiotor: https://github.com/torpyorg/aiotor


If someone with experience in asyncio field can make code review I will 
be appreciated for any comments.


I prepared pull request to make it convenient to review and comment on 
the code: https://github.com/torpyorg/aiotor/pull/1


Thanks in advance.
--
https://mail.python.org/mailman/listinfo/python-list


asyncio project code review

2021-01-08 Thread James

Good day everyone.

I have new asyncio project which use aiohttp connector and asyncio 
protocols/transports for tunneling packets through Tor Network cleanly. 
Project called aiotor: https://github.com/torpyorg/aiotor


If someone with experience in asyncio field can make code review I will 
be appreciated for any comments.


I prepared pull request to make it convenient to review and comment on 
the code: https://github.com/torpyorg/aiotor/pull/1



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


Re: Remove duplicate values from dictionary without removing key

2021-01-08 Thread MRAB

On 2021-01-08 09:56, Umar Draz wrote:

I want to replace duplicate values with empty "" in my dictionary. Here is
my original dictionary.

items = [
 {'client': 'xyz', 'name': "Ilir Meta", 'rating': 0.06, 'total': 100},
 {'client': 'xyz','name': "Abdelmadjid Tebboune", 'rating': 4.0,
'total': 100},
 {'client': 'xyz','name': "Alexander Lukashenko", 'rating': 3.1,
'total': 100},
 {'client': 'xyz', 'name': "Miguel Díaz-Canel", 'rating': 0.32,
'total': 100},
 {'client': 'udz', 'name': "Ilir Meta", 'rating': 0.06, 'total': 150},
 {'client': 'udz', 'name': "Abdelmadjid Tebboune", 'rating': 4.0,
'total': 100},
 {'client': 'udz', 'name': "Alexander Lukashenko", 'rating': 3.1,
'total': 150},
 {'client': 'udz', 'name': "Miguel Díaz-Canel", 'rating': 0.32, 'total': 
150}
]


Now I want to create another dict with like this

items = [
 {'client': 'xyz', 'name': "Ilir Meta", 'rating': 0.06, 'total': 100},
 {'client': '','name': "Abdelmadjid Tebboune", 'rating': 4.0, 'total': ''},
 {'client': '','name': "Alexander Lukashenko", 'rating': 3.1, 'total': ''},
 {'client': '', 'name': "Miguel Díaz-Canel", 'rating': 0.32, 'total': ''},
 {'client': 'udz', 'name': "Ilir Meta", 'rating': 0.06, 'total': 150},
 {'client': '', 'name': "Abdelmadjid Tebboune", 'rating': 4.0, 'total': ''},
 {'client': '', 'name': "Alexander Lukashenko", 'rating': 3.1, 'total': ''},
 {'client': '', 'name': "Miguel Díaz-Canel", 'rating': 0.32, 'total': ''}
]


Would you please help me how I can do this? and if this is not the right
place to ask this question then please help me where I can ask this? I had
tried stackoverflow but that not worked.


Iterate through the list of dicts.

If you've seen the client before, then set the appropriate value or 
values in the dict to ''.


You can use a set to remember which clients you've already seen.
--
https://mail.python.org/mailman/listinfo/python-list


[issue42863] Python venv inconsistent folder structure on windows

2021-01-08 Thread Jeff Moguillansky


Jeff Moguillansky  added the comment:

Thanks for the feedback, I understand

--

___
Python tracker 

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



[issue42863] Python venv inconsistent folder structure on windows

2021-01-08 Thread Paul Moore


Paul Moore  added the comment:

Many tools hard code the "if windows then 'Scripts' else 'bin'" logic. They 
will simply fail to work with environments that don't have that layout. Yes, 
they probably should use sysconfig, but many don't (and sometimes for arguably 
good reasons, for example tools run using one Python interpreter that 
manipulate the environment of a different one).

It's something that *could* be changed, but the cost would be significant, the 
work needed to manage the transition is non-trivial, and the benefit isn't 
particularly obvious - "consistency" is never very compelling in isolation, and 
"works better with meson" is likely to be met with the argument that Python's 
layout has been around longer than meson, so it's on meson to accommodate 
Python, not the other way around.

I'm not actively against the idea, but neither do I particularly support it 
(I'm pretty sure it would require work for pip, for no benefit to pip's 
existing users, so it's a net loss for me personally).

If you're interested in pushing for this change go for it - I suspect that it 
would probably need a PEP, and at the very least it would need a community 
discussion - but be prepared for it to meet with a certain amount of resistance.

--

___
Python tracker 

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



[issue42863] Python venv inconsistent folder structure on windows

2021-01-08 Thread Jeff Moguillansky


Jeff Moguillansky  added the comment:

Maybe we can consider adding additional params and a new code path to python -m 
venv?  This way we don't break any existing functionality?

e.g. -includedir=... -libdir=... -bindir=...
?

--

___
Python tracker 

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



[issue24464] "sqlite3_enable_shared_cache" deprecation warning when compiling with macOS system SQLite3

2021-01-08 Thread Erlend Egeberg Aasland


Change by Erlend Egeberg Aasland :


--
pull_requests: +22997
pull_request: https://github.com/python/cpython/pull/24170

___
Python tracker 

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



Re: better handling of "pinned" modules?

2021-01-08 Thread Chris Angelico
On Sat, Jan 9, 2021 at 5:18 AM Andrew Jaffe  wrote:
>
> Hi,
>
> I don't know if this makes more sense here or on "python-ideas" (or
> elsewhere?) but I'll try this first:
>
> I am starting to encounter more and more instances of packages requiring
> older, pinned, versions of modules, and this is occasionally actually
> starting to cause conflicts.
>

The first thing to do is to see if those packages ACTUALLY need older
versions of those dependencies. There's a good chance they don't.

To avoid creating this sort of problem, don't depend on a highly
specific version of things; just depend on a minimum version, and if
there's a problem (ONLY if there's a problem), a maximum version.

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


[issue42863] Python venv inconsistent folder structure on windows

2021-01-08 Thread Steve Dower


Steve Dower  added the comment:

> From the perspective of the overall system, I think it would simplify 
> integration and reduce complexity if we normalize folder structures across 
> platforms instead of having different folder structures.

I agree. But from the perspective of not breaking every existing system out 
there, it makes more sense to not suddenly change it.

If you'd like to champion the 2-3 year (a.k.a. 2-3 release) migration effort to 
get there, I'm more than happy to make sure you're taken seriously by the rest 
of the core team. I'm just not prepared to champion it myself :) I have other 
concerns to use my OSS time for.

--

___
Python tracker 

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



[issue42851] Subclassing Enum with ipaddress.IPv4Network/IPv6Network raises TypeError.

2021-01-08 Thread Ethan Furman


Change by Ethan Furman :


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

___
Python tracker 

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



better handling of "pinned" modules?

2021-01-08 Thread Andrew Jaffe

Hi,

I don't know if this makes more sense here or on "python-ideas" (or 
elsewhere?) but I'll try this first:


I am starting to encounter more and more instances of packages requiring 
older, pinned, versions of modules, and this is occasionally actually 
starting to cause conflicts.


It seems that the "official" way to handle this is through virtual 
environments, but this is not ideal for my workflow, which usually 
involves a lot of exploratory analysis -- I don't know which packages 
I'll need before I start (and, in any event, there's no guarantee I 
won't need conflicting packages).


Are there any good workarounds, or proposals for actual solutions so 
that multiple versions of a package can be installed? I understand that 
this is not trivial. Where would the "pinning" happen? It could be in 
the source code, so that it would somehow happen in the `import` 
statement (e.g., by explicitly renaming the package in question to 
include a version number, or less likely, by a new `import` syntax)? Or 
it could happen in the structure of the way modules are stored so that, 
for example, any imports that happen within a specific package egg would 
be directed to a specific version stored within the egg or in some other 
known location?


Is this an issue worth tackling?

Or do we just have to rely on package developers to keep up with their 
dependencies?


Yours,

Andrew

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


Remove duplicate values from dictionary without removing key

2021-01-08 Thread Umar Draz
I want to replace duplicate values with empty "" in my dictionary. Here is
my original dictionary.

items = [
{'client': 'xyz', 'name': "Ilir Meta", 'rating': 0.06, 'total': 100},
{'client': 'xyz','name': "Abdelmadjid Tebboune", 'rating': 4.0,
'total': 100},
{'client': 'xyz','name': "Alexander Lukashenko", 'rating': 3.1,
'total': 100},
{'client': 'xyz', 'name': "Miguel Díaz-Canel", 'rating': 0.32,
'total': 100},
{'client': 'udz', 'name': "Ilir Meta", 'rating': 0.06, 'total': 150},
{'client': 'udz', 'name': "Abdelmadjid Tebboune", 'rating': 4.0,
'total': 100},
{'client': 'udz', 'name': "Alexander Lukashenko", 'rating': 3.1,
'total': 150},
{'client': 'udz', 'name': "Miguel Díaz-Canel", 'rating': 0.32, 'total': 150}
]


Now I want to create another dict with like this

items = [
{'client': 'xyz', 'name': "Ilir Meta", 'rating': 0.06, 'total': 100},
{'client': '','name': "Abdelmadjid Tebboune", 'rating': 4.0, 'total': ''},
{'client': '','name': "Alexander Lukashenko", 'rating': 3.1, 'total': ''},
{'client': '', 'name': "Miguel Díaz-Canel", 'rating': 0.32, 'total': ''},
{'client': 'udz', 'name': "Ilir Meta", 'rating': 0.06, 'total': 150},
{'client': '', 'name': "Abdelmadjid Tebboune", 'rating': 4.0, 'total': ''},
{'client': '', 'name': "Alexander Lukashenko", 'rating': 3.1, 'total': ''},
{'client': '', 'name': "Miguel Díaz-Canel", 'rating': 0.32, 'total': ''}
]


Would you please help me how I can do this? and if this is not the right
place to ask this question then please help me where I can ask this? I had
tried stackoverflow but that not worked.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: This is a test

2021-01-08 Thread Wesley Peng
Please don't send a test message to the public list which was read by
thousands of people. thanks.

On Fri, Jan 8, 2021 at 5:26 AM Craig Hatch  wrote:

> I have added you to the EMAIL  list, so when I have questions.
>
> Just learn for fun.
>
>
> Craig Hatch
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue42863] Python venv inconsistent folder structure on windows

2021-01-08 Thread Jeff Moguillansky


Jeff Moguillansky  added the comment:

To give more context regarding this issue:
I'm currently using meson build system to generate the pkg-config files, and it 
seems that the paths "include", "lib" are hardcoded.  

>From the perspective of the overall system, I think it would simplify 
>integration and reduce complexity if we normalize folder structures across 
>platforms instead of having different folder structures.

--

___
Python tracker 

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



[issue9694] argparse required arguments displayed under "optional arguments"

2021-01-08 Thread paul j3


paul j3  added the comment:

Since this issue is closed it might be a good idea to open a new one with this 
problem.  And if possible identify the failed tests.  

We forgot to allow for the fact that working code/tests might be checking for 
specific help messages, checks the will fail when this group label is changed.

--

___
Python tracker 

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



[issue42863] Python venv inconsistent folder structure on windows

2021-01-08 Thread Steve Dower


Steve Dower  added the comment:

I'm afraid not, at least not without breaking everyone who has hardcoded the 
paths already. And I'm pretty sure that include directory is never used 
anymore, either (at least not by distutils, and not by default).

The sysconfig module provides the programmatic interface to the directory 
structure - I'd suggest using "sysconfig.get_paths()" to find the locations 
where files may be written to.

I'd also suggest building your native C library to a wheel and then installing 
that into the virtual environment, as that's the supported way of adding files. 
In that case, there's other tooling for specifying the destination for 
particular files, and it all already takes into account the layout on different 
platforms.

--

___
Python tracker 

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



[issue42867] Entry Widget not editable on Windows 10, but is on Linux Ubuntu 16.04

2021-01-08 Thread John McCabe


John McCabe  added the comment:

@epaine Thank you for your comments. Although the order of events in the 
example you quoted isn't the same as in the application I'm using 
(tk.messagebox.askquestion() is called a long time before the Enter widget is 
created in the application, not the other way round), what you've suggested, 
and a bit of extra thought, has led to a solution for me. I wrapped the 
self.createWidgets call in self.after_idle() (so 
self.after_idle(self.createWidgets)) and that appears to do the job.

Many thanks; it's appreciated.

--

___
Python tracker 

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



[issue42850] Process hangs when calling urllib.request in a multiprocessing.Process with import of sounddevice package

2021-01-08 Thread Ned Deily


Ned Deily  added the comment:

Also note that there are known problems with using the "fork" start method of 
multiprocessing on macOS. As of Python 3.8, the default start methord on macOS 
is now "spawn":

https://docs.python.org/3.9/library/multiprocessing.html#contexts-and-start-methods

Try using "spawn" and/or upgrade to a more recent version of Python 3 (3.9.1 is 
current).

--
nosy: +ned.deily

___
Python tracker 

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



[issue42865] sysconfig appends CFLAGS to LD

2021-01-08 Thread Ned Deily


Change by Ned Deily :


--
nosy: +ned.deily

___
Python tracker 

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



[issue42798] pip search fails

2021-01-08 Thread Benjamin Peterson


Change by Benjamin Peterson :


--
resolution:  -> third party
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue41116] build on macOS 11 (beta) does not find system-supplied third-party libraries

2021-01-08 Thread Ned Deily


Ned Deily  added the comment:

> I am running macOS Big Sur Version 11.1 on Silicon and still get the error 
> about the missing lzma.h file.

Unfortunately, Apple does not include the XZ library with macOS so, to build 
that module, you will need to supply a copy from another source, either build 
it yourself or from a third-party library provider like Homebrew or MacPorts.  
The Python Developer's Guid has some suggestions:

https://devguide.python.org/setup/#macos-and-os-x

--

___
Python tracker 

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



[issue41116] build on macOS 11 (beta) does not find system-supplied third-party libraries

2021-01-08 Thread seb


seb  added the comment:

I am running macOS Big Sur Version 11.1 on Silicon and still get the error 
about the missing lzma.h file. I can confirm that I use the latest Python 3.9.1 
version which includes the patches of this issue.

gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv 
-O3 -Wall -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter 
-Wno-missing-field-initializers -Wstrict-prototypes 
-Werror=implicit-function-declaration -fvisibility=hidden -I./Include/internal 
-I./Include -I. -I/usr/local/include 
-I/Users/dev/Downloads/Python-3.9.1/Include -I/Users/dev/Downloads/Python-3.9.1 
-c /Users/dev/Downloads/Python-3.9.1/Modules/_lzmamodule.c -o 
build/temp.macosx-11.1-arm64-3.9/Users/dev/Downloads/Python-3.9.1/Modules/_lzmamodule.o
/Users/dev/Downloads/Python-3.9.1/Modules/_lzmamodule.c:16:10: fatal error: 
'lzma.h' file not found
#include 

Is this supposed to be still the case? Thank you!

--
nosy: +seb

___
Python tracker 

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



[issue41742] Request for docs.python.org/3/library/configparser.html#exceptions improvement

2021-01-08 Thread Irit Katriel


Change by Irit Katriel :


--
keywords: +easy

___
Python tracker 

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



[issue42867] Entry Widget not editable on Windows 10, but is on Linux Ubuntu 16.04

2021-01-08 Thread E. Paine


E. Paine  added the comment:

This is a Tk/Windows issue, not tkinter. I tested the following on Windows 10 
using Tk 8.6.9:

# Our entry
pack [entry .e]

# Causes the entry to fail
#tk_messageBox -title Title -message Message
#after 0 tk_messageBox -title Title -message Message

# Does not cause the entry to fail
#after 1 tk_messageBox -title Title -message Message
after idle tk_messageBox -title Title -message Message

I have not tried on a later version of Tk so it may be fixed but it also may be 
a fundamental Windows issue. The workaround would be to either use .after(1, 
...) or .after_idle(...)

--
nosy: +epaine
versions: +Python 3.10, Python 3.8

___
Python tracker 

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



[issue42269] Add ability to set __slots__ in dataclasses

2021-01-08 Thread lcy


Change by lcy :


--
nosy: +lcy0321

___
Python tracker 

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



[issue9694] argparse required arguments displayed under "optional arguments"

2021-01-08 Thread Miro Hrončok

Miro Hrončok  added the comment:

Coudl this please be mentioned on 
https://docs.python.org/3.10/whatsnew/3.10.html ?

At least two packages fail tests because of the change (ipython and 
sphinxcontrib-autoprogram).

--
nosy: +hroncok

___
Python tracker 

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



[issue31213] __context__ reset to None in nested exception

2021-01-08 Thread Irit Katriel


Irit Katriel  added the comment:

This seems to be deliberately done here in order to prevent context cycles from 
forming: 
https://github.com/python/cpython/blob/fe6e5e7cfd68eeaa69fd1511f354a1b4d8d90990/Python/errors.c#L148

In your code you are creating a cycle where foo is the context (and cause) for 
bar which is the context (and cause) of the second time foo is raised. 

If you create a new instance of foo for the second raise then there is no cycle 
and you get what you expect:

try:
try:
raise Exception('foo')
except Exception as foo:
print("1--", foo, foo.__context__, foo.__cause__)
try:
raise Exception('bar') from foo
except Exception as bar:
print("2--", bar, bar.__context__, bar.__context__.__context__)
raise Exception('foo2') from bar
except Exception as foo:
wat = foo

print("3--", wat, wat.__context__, wat.__context__.__context__)
print("4--", wat, wat.__cause__, wat.__cause__.__context__)
print("5--", wat, wat.__cause__, wat.__cause__.__cause__)


Output is:

1-- foo None None
2-- bar foo None
3-- foo2 bar foo
4-- foo2 bar foo
5-- foo2 bar foo


I think the bug is in your code - you can't create an exception chain that 
contains the same exception instance more than once.

--
nosy: +iritkatriel

___
Python tracker 

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



[issue42866] test test_multibytecodec: Test_IncrementalEncoder.test_subinterp() leaks references

2021-01-08 Thread STINNER Victor


STINNER Victor  added the comment:

Ok, it's now fixed.

To make sure that a heap type can be deleted, it must by a GC type, has a 
traverse function, and it must track its instances. We should take this in 
account when we convert static types to heap types. In practice, deleting a 
type is mostly an issue when we check for reference leak and an instance is 
kept alive until the last GC collection, at the end of Py_EndInterpreter().

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



[issue42868] SpooledTemporaryFile.__iter__ is not transparent to rollover

2021-01-08 Thread Jin-oh Kang


New submission from Jin-oh Kang :

In tempfile, SpooledTemporaryFile.__iter__ is defined as follows:

# file protocol
def __iter__(self):
return self._file.__iter__()

A rollover would switch the underlying _file object from a BytesIO to a 
TemporaryFile, thereby leaving the original iterator stale.

This may be fixed by:

def __iter__(self):
while True:
line = self._file.readline()
if not line:
break
yield line

Or perhaps:

def __iter__(self):
while True:
file = self._file
for line in file:
yield line
if file is not self._file:
break
else:
break

--
components: Library (Lib)
messages: 384674
nosy: jinoh.kang.kr
priority: normal
severity: normal
status: open
title: SpooledTemporaryFile.__iter__ is not transparent to rollover
type: behavior
versions: Python 3.10

___
Python tracker 

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



[issue42866] test test_multibytecodec: Test_IncrementalEncoder.test_subinterp() leaks references

2021-01-08 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 11ef53aefbecfac18b63cee518a7184f771f708c by Victor Stinner in 
branch 'master':
bpo-42866: Add traverse func to _multibytecodec.MultibyteCodec (GH-24166)
https://github.com/python/cpython/commit/11ef53aefbecfac18b63cee518a7184f771f708c


--

___
Python tracker 

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



[issue42867] Entry Widget not editable on Windows 10, but is on Linux Ubuntu 16.04

2021-01-08 Thread John McCabe


John McCabe  added the comment:

Thank you.

Wrt to your initial suggestion, I recognise Python's popularity will make 
things busy, and I will ask if anyone knows of a workaround in other fora, but 
a bug's a bug and, IMO, if something behaves differently on different 
platforms, using packages that are part of the Python install, for no apparent 
reason, then that's a bug! (Especially as the same thing was reported over 10 
years ago, on what would be a very different version of Python).

--

___
Python tracker 

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



[issue42866] test test_multibytecodec: Test_IncrementalEncoder.test_subinterp() leaks references

2021-01-08 Thread Erlend Egeberg Aasland


Erlend Egeberg Aasland  added the comment:

Ah, thanks! I also found that info in the docs: 
https://docs.python.org/3/c-api/typeobj.html#c.PyTypeObject.tp_free

--

___
Python tracker 

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



[issue42866] test test_multibytecodec: Test_IncrementalEncoder.test_subinterp() leaks references

2021-01-08 Thread miss-islington


Change by miss-islington :


--
pull_requests: +22996
pull_request: https://github.com/python/cpython/pull/24168

___
Python tracker 

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



[issue42866] test test_multibytecodec: Test_IncrementalEncoder.test_subinterp() leaks references

2021-01-08 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 3.0 -> 4.0
pull_requests: +22995
pull_request: https://github.com/python/cpython/pull/24167

___
Python tracker 

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



[issue42866] test test_multibytecodec: Test_IncrementalEncoder.test_subinterp() leaks references

2021-01-08 Thread STINNER Victor


STINNER Victor  added the comment:

typo: My PR uses the generic tp->tp_free which *is* PyObject_GC_Del().

--

___
Python tracker 

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



[issue42866] test test_multibytecodec: Test_IncrementalEncoder.test_subinterp() leaks references

2021-01-08 Thread STINNER Victor


STINNER Victor  added the comment:

> Don't you need to free memory using PyObject_GC_Del when you allocate using 
> PyObject_GC_New?

My PR uses the generic tp->tp_free which PyObject_GC_Del().

--

___
Python tracker 

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



[issue42867] Entry Widget not editable on Windows 10, but is on Linux Ubuntu 16.04

2021-01-08 Thread Christian Heimes


Christian Heimes  added the comment:

I'm involving TJ and Serhiy. They might have free resources and might be able 
to assist.

I initially suggested to get assistance in user forums, because we have very 
limited resources. To give you an impression, there are more than 7,500 open 
bugs on BPO and more than 1,400 open PRs on Github..

--
nosy: +serhiy.storchaka, terry.reedy

___
Python tracker 

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



[issue42866] test test_multibytecodec: Test_IncrementalEncoder.test_subinterp() leaks references

2021-01-08 Thread Erlend Egeberg Aasland


Erlend Egeberg Aasland  added the comment:

Ref. https://docs.python.org/3/c-api/typeobj.html#Py_TPFLAGS_HAVE_GC

--

___
Python tracker 

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



[issue30701] Exception parsing certain invalid email address headers

2021-01-08 Thread Irit Katriel


Change by Irit Katriel :


--
resolution:  -> out of date
stage:  -> resolved
status: pending -> closed

___
Python tracker 

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



[issue42867] Entry Widget not editable on Windows 10, but is on Linux Ubuntu 16.04

2021-01-08 Thread John McCabe


John McCabe  added the comment:

In addition, changing "Entry" to "Text" (+ necessary associated changes) makes 
no difference to the outcome. Removing the call to tk.messagebox.askquestion() 
does. It appears that tk.messagebox.askquestion() is screwing something up on 
Windows; perhaps it's locking some resources, or not correctly releasing them.

--

___
Python tracker 

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



[issue42866] test test_multibytecodec: Test_IncrementalEncoder.test_subinterp() leaks references

2021-01-08 Thread Erlend Egeberg Aasland


Erlend Egeberg Aasland  added the comment:

Don't you need to free memory using PyObject_GC_Del when you allocate using 
PyObject_GC_New?

--

___
Python tracker 

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



[issue42867] Entry Widget not editable on Windows 10, but is on Linux Ubuntu 16.04

2021-01-08 Thread John McCabe


John McCabe  added the comment:

It's reproducible in both 3.8 and 3.9 on Windows 10.

--
versions: +Python 3.9 -Python 3.6

___
Python tracker 

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



[issue42867] Entry Widget not editable on Windows 10, but is on Linux Ubuntu 16.04

2021-01-08 Thread Christian Heimes


Christian Heimes  added the comment:

Can your produce the issue with Python 3.8 or newer on any platform? 3.6 and 
3.7 are in security fix-only mode. If it's truly a bug in Python, then we won't 
fix the issue any way.

--

___
Python tracker 

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



[issue42866] test test_multibytecodec: Test_IncrementalEncoder.test_subinterp() leaks references

2021-01-08 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +22994
pull_request: https://github.com/python/cpython/pull/24166

___
Python tracker 

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



[issue42866] test test_multibytecodec: Test_IncrementalEncoder.test_subinterp() leaks references

2021-01-08 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset e542d417b96077d04aec089505eacb990c9799ae by Victor Stinner in 
branch 'master':
bpo-42866: Fix refleak in CJK getcodec() (GH-24165)
https://github.com/python/cpython/commit/e542d417b96077d04aec089505eacb990c9799ae


--

___
Python tracker 

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



[issue42866] test test_multibytecodec: Test_IncrementalEncoder.test_subinterp() leaks references

2021-01-08 Thread STINNER Victor


STINNER Victor  added the comment:

Calling gc.collect() twice works around the issue, which sounds like a missing 
traverse function somewhere.

diff --git a/Python/pystate.c b/Python/pystate.c
index c791b23999..66bbe1bf7d 100644
--- a/Python/pystate.c
+++ b/Python/pystate.c
@@ -321,6 +321,7 @@ interpreter_clear(PyInterpreterState *interp, PyThreadState 
*tstate)
 
 /* Last garbage collection on this interpreter */
 _PyGC_CollectNoFail(tstate);
+_PyGC_CollectNoFail(tstate);
 _PyGC_Fini(tstate);
 
 /* We don't clear sysdict and builtins until the end of this function.

--

___
Python tracker 

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



[issue42867] Entry Widget not editable on Windows 10, but is on Linux Ubuntu 16.04

2021-01-08 Thread John McCabe


John McCabe  added the comment:

Is behaviour that differs between platforms, using components that are listed 
in the "classification" -> "Components" section NOT a bug then?

--

___
Python tracker 

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



[issue14655] traceback module docs should show how to print/fomat an exception object

2021-01-08 Thread Irit Katriel


Irit Katriel  added the comment:

In issue 26389 the api was changed so that now format_exception(exc) works.

--
resolution:  -> duplicate
stage: needs patch -> resolved
status: open -> closed
superseder:  -> Expand traceback module API to accept just an exception as an 
argument

___
Python tracker 

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



[issue42853] `OverflowError: signed integer is greater than maximum` in ssl.py for files larger than 2GB

2021-01-08 Thread Christian Heimes


Christian Heimes  added the comment:

That's a good idea, Ronald! socket.c:sock_send_impl() already clamps the input 
length on Windows:

#ifdef MS_WINDOWS
if (ctx->len > INT_MAX)
ctx->len = INT_MAX;
ctx->result = send(s->sock_fd, ctx->buf, (int)ctx->len, ctx->flags);
#else
ctx->result = send(s->sock_fd, ctx->buf, ctx->len, ctx->flags);
#endif

I could implement a similar logic for SSLSocket. Applications have to check the 
return value of send() any way or use sendall(). The socket.send() method / 
send(2) libc function may also write less bytes.

--

___
Python tracker 

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



[issue42867] Entry Widget not editable on Windows 10, but is on Linux Ubuntu 16.04

2021-01-08 Thread Christian Heimes


Christian Heimes  added the comment:

Hi,

bugs.python.org is an issue tracker for bugs and feature requests. Please use 
platforms like Python user mailing list, stack overflow, or reddit for general 
help with Python and libraries.

--
nosy: +christian.heimes

___
Python tracker 

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



[issue42867] Entry Widget not editable on Windows 10, but is on Linux Ubuntu 16.04

2021-01-08 Thread John McCabe


New submission from John McCabe :

I've built an application using tkinter (see below). I'm fairly new to tkinter, 
despite having substantial software experience (33 years), so the layout might 
be a bit odd/wrong, and the example obviously doesn't follow PEP-8 guidelines, 
however...

Basically this application (which is a bit more than minimal, but should be 
easy to follow) is designed to manage pairs of text values as JSON, 
saving/loading from a file. When it starts, the user is asked if they want to 
read in an existing file of data; if they select NO, a fairly empty frame with 
3 buttons showing "+", "Save" and "Quit" is displayed.

At this point, if "+" is pressed, a new row with two labels and two Entry 
widgets is added to the frame.

However (and this is the problem which appears to be identical to that reported 
in Issue #9673), it is not possible to set focus into either of the Entry 
widgets on Windows 10; there is no problem doing this on Ubuntu 16.04 (although 
I've only got Python 3.5 on there)

If the "Save" button is then pressed, a message box pops up telling the use 
that no changes have been saved. Once OK has been pressed on that, it becomes 
possible to set focus into the Entry widgets.

One of the problems with Issue #9673 was that no 'minimal' example was provided 
showing this behaviour, and the very minimal example given in 
https://bugs.python.org/issue9673#msg218765 doesn't exhibit the problem, hence 
the example below being a bit more than minimal, while still not being 
particularly complicated.


#!/usr/bin/python3

import os
import tkinter as tk
from tkinter import filedialog, messagebox
import json

class Application(tk.Frame):

def __init__(self, master):
super().__init__(master)
self.master = master
self.grid()
self.originalJson = {}
self.inFileName = ""
self.leftRightEntries = []
self.fileDlgOpts = { "initialdir"   : os.getcwd(),
 "initialfile"  : "file.json",
 "filetypes": (("JSON File", "*.json"), 
("All Files","*.*")),
 "defaultextension" : '.json',
 "title": "Select A File" }
self.createWidgets()

def openInFile(self):
fileName = ""
reuse = tk.messagebox.askquestion("Use An Existing File", "Do you want 
to load and use an existing file?")
if reuse == "yes":
fileName = tk.filedialog.askopenfilename(**self.fileDlgOpts)
if fileName is not "":
try:
with open(fileName, 'r') as json_file:
self.originalJson = json.load(json_file)
json_file.close()
except Exception:
tk.messagebox.showerror("Use An Existing File", "File could 
not be loaded; continuing without one.")
fileName = ""
else:
tk.messagebox.showwarning("Use An Existing File", "No existing 
file specified; continuing without one.")

return fileName

def createWidgets(self):
self.inFileName = self.openInFile()

# We add the buttons to some huge numbered row because we might want to 
insert more
# rows, and the layout manager will collapse everything in between. 
Also we
# add these first because of the way the tab order is set up
self.addBtn = tk.Button(self.master, text = "+", command = self.addNew)
self.addBtn.grid(row = 100, column = 0, sticky = tk.W)

# Save button; pretty self-explanatory
self.saveBtn = tk.Button(self.master, text = "Save", command = 
self.save)
self.saveBtn.grid(row = 100, column = 2, sticky = tk.W)

# Quit button; pretty self-explanatory
self.quitBtn = tk.Button(self.master, text = "QUIT", fg = "red", 
command = self.quit)
self.quitBtn.grid(row = 100, column = 3, sticky = tk.E)

# If there is original json, work through each key and put the fields 
on the display
rowNum = 0
for leftText in sorted(self.originalJson.keys()):
self.insertRow(rowNum, leftText);
rowNum = rowNum + 1

self.nextEmptyRow = rowNum

self.redoPadding()

def redoPadding(self):
for child in self.master.winfo_children():
child.grid_configure(padx = 5, pady = 5)

def focusNextWidget(self, event):
event.widget.tk_focusNext().focus()
return("break")

def insertRow(self, rowNum, initialLeft = None):
tk.Label(self.master, height = 1, text = "Left: ").grid(row = rowNum, 
column = 0, sticky = tk.W)
leftBox = tk.Entry(self.master, width = 20)
leftBox.grid(row = rowNum, column = 1, sticky = tk.W)
leftBox.bind("", self.focusNextWidget)
if initialLeft is not None:
leftBox.insert(tk.END, initialLeft)
tk.Label(self.master, height = 1, 

  1   2   >