RE: TKinter in Python - advanced notions

2023-06-23 Thread Andreas Heckel via Python-list
Hi,

Apologies for potentially mis-using this thread. But I have been struggling 
recently making exactly this leap from simple GUI examples to a more elaborate 
MVVM concept. Mainly I have been struggling finding nice example python code 
bases, that allow some understanding to the beginner, which I certainly still 
am, but also show enough complexity to see the concept in action.
Any hints / links to github or similar highly welcome. If the list is not the 
appropriate place, I am happy if you email me directly.

Cheers,
Andreas

> -Original Message-
> From: Python-list 
> On Behalf Of Diego Souza via Python-list
> Sent: Friday, June 23, 2023 4:14 AM
> To: aapost 
> Cc: python-list
> Subject: Re: TKinter in Python - advanced notions
> 
> Have you considered improving the architecture itself, not your GUI library
> skills?
> 
> I recommend you look at the Model View ViewModel (MVVM) concept and
> implement something similar (this is largely used in the Android framework
> nowadays). This would separate your program logic from the rendering and
> visualization. It would also make your program more reactive, decoupled,
> and easier to maintain. When you mentioned threads I immediately thought of
> this because it is much easier to implement parallel jobs and present
> results back in the GUI, as everything becomes reactive. This is overkill
> for a small project such as the code you showed, but I recommend it for
> larger projects.
> 
> 
> 
> 
> 
> On Wed, Jun 21, 2023 at 7:20 PM aapost via Python-list <
> python-list@python.org> wrote:
> 
> > On 6/21/23 09:47, Dan Kolis wrote:
> > > I've write a huge biotech program ( an IDE for synthetic biology ), and
> > am slowly outgrowing TKINTER.
> > >
> > > Has anybody out there merged a little bit of TCL direct calls from
> > Python 3.X to get more freedom then TKINTER for just some Windows ?
> >
> > > I wish it looked better, but its 'ok'. I believe X11 IO is considerably
> > superior for serious work the HTML.  I mean 'serious' work. with lots of
> > multi media windows. I am not talking about fb "Oh ! There is a window it
> > opened inthe corner !"... trivial functionality.
> >
> >
> > I don't know if it would help, but you can extend/add tcl/tk packages
> >
> > I don't remember the full instructions right off, but quickly reverse
> > engineering my old stuff I think you just need to drop them in
> > /usr/share/tcltk/ or equivalent.
> >
> > (I needed to do that to replace the terrible looking default file dialog
> > for unix/linux with fsdialog.)
> >
> > then running something like the following from your Tk object
> >
> > self.eval('package require fsdialog')
> >
> > (reverse engineering the python tkinter source you can likely find other
> > ways of doing more tcl direct stuff)
> >
> > I have not researched if there are some better, more featured
> > (non-buggy) Text widgets implemented in tcl that can be dropped in, (I
> > know several of the tcl drop in widgets I tried were lacking in
> > refinement).
> >
> >  From what I can tell, once upon a time there were better, more
> > interesting projects and tutorials on extending tkinter, such as WCK
> > (tkinter3000), but the only remnants of those remain publicly available
> > are outdated unmaintained archives.
> >
> > You might also consider looking at the Grail browser source for research
> > purposes, as it does some interesting things with some of the widgets,
> > (parsing html and such), even though it is 20 years old now (and written
> > in python 1).
> > The update attempts from 10+ years ago have disappeared. (it's license
> > is considered questionable from what I understand, so not sure if that
> > is an aspect of it, the other being one of it's main features, python
> > applets, is unsafe and was not easily fixable)
> >
> > You might already be beyond some of these things though.
> >
> > I know what you mean as far is feeling like the little bit extra you
> > need pushes beyond what tkinter can do / makes you feel like you have
> > outgrown the module.
> >
> > (I had to take a break from one of my projects and send it to
> > development hell until my UI knowledge/skills improve after I found
> > myself considering using xml schema appinfo annotations to store json
> > formatted widget specific information, lol.)
> >
> > I have felt that sense of lack with most of the UI modules I have tried
> > though.
> >
> > I don't know of a clear better python-only solution though that fits my
> > personal needs.
>

Re: built-in pow() vs. math.pow()

2023-04-03 Thread Andreas Eisele
Andreas Eisele schrieb am Donnerstag, 30. März 2023 um 11:16:02 UTC+2:
> I sometimes make use of the fact that the built-in pow() function has an 
> optional third argument for modulo calculation, which is handy when dealing 
> with tasks from number theory, very large numbers, problems from Project 
> Euler, etc. I was unpleasantly surprised that math.pow() does not have this 
> feature, hence "from math import *" overwrites the built-in pow() function 
> with a function that lacks functionality. I am wondering for the rationale of 
> this. Does math.pow() do anything that the built-in version can not do, and 
> if not, why is it even there? 
> Thanks in advance for any enlightening comment on this. 
> Best regards, Andreas

Thanks a lot to all of you for the insightful replies! 
I now understand why math.pow() behaves the way it does and whoever tells me I 
should have read the doc of the math module before using it is 100% on point. 
BTW, there is another difference: built-in pow() deals with complex arguments, 
while functions in math won't accept them at all.
I also agree with the warning that importing * from any module is generally a 
bad idea, and I normally would not do it.  But here I had written a little tool 
that evaluates an expression given on the command line, and in this case having 
math functions available without further ado is very convenient, so it seemed 
appropriate to make an exeption to this rule.
I ended up assigning the built-in pow function to a different name before 
importing the math module, which is a good way to keep both variants accessible.
Best regards, and thanks again, Andreas
-- 
https://mail.python.org/mailman/listinfo/python-list


built-in pow() vs. math.pow()

2023-03-30 Thread Andreas Eisele
I sometimes make use of the fact that the built-in pow() function has an 
optional third argument for modulo calculation, which is handy when dealing 
with tasks from number theory, very large numbers, problems from Project Euler, 
etc. I was unpleasantly surprised that math.pow() does not have this feature, 
hence "from math import *" overwrites the built-in pow() function with a 
function that lacks functionality. I am wondering for the rationale of this. 
Does math.pow() do anything that the built-in version can not do, and if not, 
why is it even there?
Thanks in advance for any enlightening comment on this.
Best regards, Andreas
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Find the path of a shell command

2022-10-17 Thread Andreas Eder
On Mi 12 Okt 2022 at 05:00, Paulo da Silva 
 wrote:

> The simple question: How do I find the full path of a shell command
> (linux), i.e. how do I obtain the corresponding of, for example,
> "type rm" in command line?
>
> The reason:
> I have python program that launches a detached rm. It works pretty well
> until it is invoked by cron! I suspect that for cron we need to specify
> the full path.
> Of course I can hardcode /usr/bin/rm. But, is rm always in /usr/bin?
> What about other commands?

Why not just use os.unlink ?

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


Re: Performance issue with CPython 3.10 + Cython

2022-10-07 Thread Andreas Ames
Answering to myself, just for the records:

1. The culprit was me. As lazy as I am, I have used f-strings all over the
place in calls to `logging.logger.debug()` and friends, evaluating all
arguments regardless of whether the logger was enabled or not.  Replacing
these f-strings by regular printf-like format strings solved the issue.
Now the application bowls happily along, consistently below 0.02 seconds
per second application time.
2. Valgrind + callgrind is an awesome toolchain to spot performance issues,
even on VMs.


Am Di., 4. Okt. 2022 um 11:05 Uhr schrieb Andreas Ames <
andreas.0815.qwe...@gmail.com>:

> Hi all,
>
> I am wrapping an embedded application (, which does not use any dynamic
> memory management,) using Cython to call it from CPython.  The wrapped
> application uses a cyclic executive, i.e. everything is done in the
> input-logic-output design, typical for some real-time related domains.
> Consequentially, every application cycle executes more or less the very
> same code.  As I am still in a prototyping stadium, the wrapped process is
> completely CPU-bound, i.e. except of some logging output there is no I/O
> whatsoever.
>
> During one second of "application time", I am doing exactly 120 calls into
> the application through three Cython-wrapped API functions.  The
> application uses some platform-dependent APIs, which I have also wrapped
> with Cython, so that there are numerous callbacks into the Python realm per
> call into the application. What I am observing now, is that the performance
> per "application second" decreases (remember: executing code that does the
> same thing on every cycle) and extending the number of loop iterations does
> not seem to cause any bound to this decrease.  In the log ouput below, you
> can see the GC counts, which look innocent to me.  The "real time" is
> measured using "time.time()". The "top" utility does not suggest any memory
> leak either.  I am developing on WSL2, but I have checked that this
> performance effect also happens on physical machines.  Right now, I am
> staring at "kcachegrind", but I have no idea, how to determine time series
> for the performance of functions (I am not looking for those functions,
> which need the most time, but for those, which consume more and more
> execution time).
>
> One more thing to look for could be memory fragmentation, but before that
> I would like to ask the experts here for their ideas and experiences and/or
> for tools, which could help to find the culprit.
>
> 2022-10-04 10:40:50|INFO|__main__   |Execution loop 0 done. GC
>> counts = (381, 9, 3); 1 second of application time corresponds to
>> 0.06862711906433105 seconds real time.
>> 2022-10-04 10:40:51|INFO|__main__   |Execution loop 100 done. GC
>> counts = (381, 9, 3); 1 second of application time corresponds to
>> 0.08224177360534668 seconds real time.
>> 2022-10-04 10:40:52|INFO|__main__   |Execution loop 200 done. GC
>> counts = (381, 9, 3); 1 second of application time corresponds to
>> 0.08225250244140625 seconds real time.
>> 2022-10-04 10:40:53|INFO|__main__   |Execution loop 300 done. GC
>> counts = (381, 9, 3); 1 second of application time corresponds to
>> 0.10176873207092285 seconds real time.
>> 2022-10-04 10:40:54|INFO|__main__   |Execution loop 400 done. GC
>> counts = (381, 9, 3); 1 second of application time corresponds to
>> 0.10900592803955078 seconds real time.
>> 2022-10-04 10:40:55|INFO|__main__   |Execution loop 500 done. GC
>> counts = (381, 9, 3); 1 second of application time corresponds to
>> 0.12233948707580566 seconds real time.
>> 2022-10-04 10:40:56|INFO|__main__   |Execution loop 600 done. GC
>> counts = (381, 9, 3); 1 second of application time corresponds to
>> 0.14058256149291992 seconds real time.
>> 2022-10-04 10:40:58|INFO|__main__   |Execution loop 700 done. GC
>> counts = (381, 9, 3); 1 second of application time corresponds to
>> 0.14777183532714844 seconds real time.
>> 2022-10-04 10:40:59|INFO|__main__   |Execution loop 800 done. GC
>> counts = (381, 9, 3); 1 second of application time corresponds to
>> 0.15729451179504395 seconds real time.
>> 2022-10-04 10:41:01|INFO|__main__   |Execution loop 900 done. GC
>> counts = (381, 9, 3); 1 second of application time corresponds to
>> 0.17365813255310059 seconds real time.
>> 2022-10-04 10:41:03|INFO|__main__   |Execution loop 1000 done. GC
>> counts = (381, 9, 3); 1 second of application time corresponds to
>> 0.17772984504699707 seconds real time.
>> 2022-10-04 10:41:05|INFO|__main__   |Exec

Performance issue with CPython 3.10 + Cython

2022-10-04 Thread Andreas Ames
-10-04 10:41:16|INFO|__main__   |Execution loop 1600 done. GC
> counts = (381, 9, 3); 1 second of application time corresponds to
> 0.2541334629058838 seconds real time.
> 2022-10-04 10:41:19|INFO|__main__   |Execution loop 1700 done. GC
> counts = (381, 9, 3); 1 second of application time corresponds to
> 0.26812195777893066 seconds real time.
> 2022-10-04 10:41:21|INFO|__main__   |Execution loop 1800 done. GC
> counts = (381, 9, 3); 1 second of application time corresponds to
> 0.28777456283569336 seconds real time.
> 2022-10-04 10:41:24|INFO|__main__   |Execution loop 1900 done. GC
> counts = (381, 9, 3); 1 second of application time corresponds to
> 0.3005337715148926 seconds real time.
> 2022-10-04 10:41:28|INFO|__main__   |Execution loop 2000 done. GC
> counts = (381, 9, 3); 1 second of application time corresponds to
> 0.30992960929870605 seconds real time.
> 2022-10-04 10:41:31|INFO|__main__   |Execution loop 2100 done. GC
> counts = (381, 9, 3); 1 second of application time corresponds to
> 0.32058119773864746 seconds real time.
> 2022-10-04 10:41:34|INFO|__main__   |Execution loop 2200 done. GC
> counts = (381, 9, 3); 1 second of application time corresponds to
> 0.33020949363708496 seconds real time.
> 2022-10-04 10:41:37|INFO|__main__   |Execution loop 2300 done. GC
> counts = (381, 9, 3); 1 second of application time corresponds to
> 0.34426307678222656 seconds real time.
> 2022-10-04 10:41:41|INFO|__main__   |Execution loop 2400 done. GC
> counts = (381, 9, 3); 1 second of application time corresponds to
> 0.3585126338965 seconds real time.
> 2022-10-04 10:41:45|INFO|__main__   |Execution loop 2500 done. GC
> counts = (381, 9, 3); 1 second of application time corresponds to
> 0.3664553165435791 seconds real time.
> 2022-10-04 10:41:48|INFO|__main__   |Execution loop 2600 done. GC
> counts = (381, 9, 3); 1 second of application time corresponds to
> 0.3767662048339844 seconds real time.
> 2022-10-04 10:41:52|INFO|__main__   |Execution loop 2700 done. GC
> counts = (381, 9, 3); 1 second of application time corresponds to
> 0.39760732650756836 seconds real time.
> 2022-10-04 10:41:56|INFO|__main__   |Execution loop 2800 done. GC
> counts = (381, 9, 3); 1 second of application time corresponds to
> 0.42221736907958984 seconds real time.
> 2022-10-04 10:42:01|INFO|__main__   |Execution loop 2900 done. GC
> counts = (381, 9, 3); 1 second of application time corresponds to
> 0.4237234592437744 seconds real time.


Thanks in advance,

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


Re: Parallel(?) programming with python

2022-08-15 Thread Andreas Croci
I would like to thank everybody who answered my question. The insight 
was very informative. This seems to be one of the few newsgroups still 
alive and kicking, with a lot of knowledgeable people taking the time to 
help others. I like how quick and easy it is to post questions and 
receive answers here as compared to web-based forums (although there are 
some disadvantages too).


I'm implementing some of the ideas received here and I will surely have 
other questions as I go. But the project will take a long time because 
I'm doing this as a hobby during my vacation, that are unfortunately 
about to end.


Thanks again, Community.

On 08.08.22 12:47, Andreas Croci wrote:
tI would like to write a program, that reads from the network a fixed 
amount of bytes and appends them to a list. This should happen once a 
second.


Another part of the program should take the list, as it has been filled 
so far, every 6 hours or so, and do some computations on the data (a FFT).


Every so often (say once a week) the list should be saved to a file, 
shorthened in the front by so many items, and filled further with the 
data coming fom the network. After the first saving of the whole list, 
only the new part (the data that have come since the last saving) should 
be appended to the file. A timestamp is in the data, so it's easy to say 
what is new and what was already there.


I'm not sure how to do this properly: can I write a part of a program 
that keeps doing its job (appending data to the list once every second) 
while another part computes something on the data of the same list, 
ignoring the new data being written?


Basically the question boils down to wether it is possible to have parts 
of a program (could be functions) that keep doing their job while other 
parts do something else on the same data, and what is the best way to do 
this.


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


Re: Parallel(?) programming with python

2022-08-08 Thread Andreas Croci

Thank you for your reply.

On 08.08.22 14:55, Julio Di Egidio wrote:


Concurrent programming is quite difficult, plus you better think
in terms of queues than shared data... 


Do you mean queues in the sense of deque (the data structure)? I ask 
because I can see the advantage there when I try to pop data from the 
front of it, but I don't see the sense of the following statement ("than 
shared data"). I mean, I called my structure a list, but it may well be 
a queue instead. That wouldn't prevent it from being shared in the idea 
I described: one function would still append data to it while the other 
is reading what is there up to a certain point and calculate the FFT of it.


 But, an easier and often

better option for concurrent data access is use a (relational)
database, then the appropriate transaction isolation levels
when reading and/or writing.



That would obviusly save some coding (but would introduce the need to 
code the interaction with the database), but I'm not sure it would speed 
up the thing. Would the RDBMS allow to read a table while something else 
is writing to it? I doubt it and I'm not sure it doesn't flush the cache 
before letting you read, which would include a normally slow disk access.


Andreas


Julio


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


Re: Parallel(?) programming with python

2022-08-08 Thread Andreas Croci

Thanks for your reply.

On 08.08.22 13:20, Stefan Ram wrote:


   Yes, but this is difficult. If you ask this question here,
   you might not be ready for this.


Indeed.



   I haven't learned it yet myself, but nevertheless tried to
   write a small example program quickly, which might still
   contain errors because of my lack of education.

import threading
import time

def write_to_list( list, lock, event ):
 for i in range( 10 ):
 lock.acquire()
 try:
 list.append( i )
 finally:
 lock.release()
 event.set()
 time.sleep( 3 )

def read_from_list( list, lock, event ):
 while True:
 event.wait()
 print( "Waking up." )
 event.clear()
 if len( list ):
 print( "List contains " + str( list[ 0 ]) + "." )
 lock.acquire()
 try:
 del list[ 0 ]
 finally:
 lock.release()
 else:
 print( "List is empty." )

list = []
lock = threading.Lock()
event = threading.Event()
threading.Thread( target=write_to_list, args=[ list, lock, event ]).start()
threading.Thread( target=read_from_list, args=[ list, lock, event ]).start()


If I understand some things correctly, a "lock" would be something that, 
as the name says, locks, meaning prevents parts of the program from 
executing on the locked resource until ohter parts have finished doing 
their things and have released the lock. If this is correct, it's not 
exactly what I wanted, because this way "parts of the program" would not 
"keep doing their things, while other parts do other things on the same 
data".


I'm in principle ok with locks, if it must be. What I fear is that the 
lock could last long and prevent the function that writes into the list 
from doing so every second. With an FFT on a list that contains a few 
bytes taken every second over one week time (604.800 samples), I believe 
it's very likely that the FFT function takes longer than a second to return.


Then I would have to import all the data I have missed since the lock 
was aquired, which is doable, but I would like to avoid it if possible.




   In basketball, first you must learn to dribble and pass,
   before you can begin to shoot.


Sure.



   With certain reservations, texts that can be considered
   to learn Python are:

"Object-Oriented Programming in Python Documentation" - a PDF file,
Introduction to Programming Using Python - Y Daniel Liang (2013),
How to Think Like a Computer Scientist - Peter Wentworth (2012-08-12),
The Coder's Apprentice - Pieter Spronck (2016-09-21), and
Python Programming - John Zelle (2009).



Thank you for the list. I an currently taking a Udemy course and at the 
same time reading the tutorials on python.org. I hope I will some day 
come to any of the books you suggest (I'm doing this only in my spare 
time and it will take forever).

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


Parallel(?) programming with python

2022-08-08 Thread Andreas Croci
tI would like to write a program, that reads from the network a fixed 
amount of bytes and appends them to a list. This should happen once a 
second.


Another part of the program should take the list, as it has been filled 
so far, every 6 hours or so, and do some computations on the data (a FFT).


Every so often (say once a week) the list should be saved to a file, 
shorthened in the front by so many items, and filled further with the 
data coming fom the network. After the first saving of the whole list, 
only the new part (the data that have come since the last saving) should 
be appended to the file. A timestamp is in the data, so it's easy to say 
what is new and what was already there.


I'm not sure how to do this properly: can I write a part of a program 
that keeps doing its job (appending data to the list once every second) 
while another part computes something on the data of the same list, 
ignoring the new data being written?


Basically the question boils down to wether it is possible to have parts 
of a program (could be functions) that keep doing their job while other 
parts do something else on the same data, and what is the best way to do 
this.

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


[issue21873] Tuple comparisons with NaNs are broken

2022-03-24 Thread Andreas Kloeckner


Change by Andreas Kloeckner :


--
nosy: +inducer

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



[issue45184] Add `pop` function to remove context manager from (Async)ExitStack

2022-02-23 Thread Andreas H.


Andreas H.  added the comment:

Inside the discussion an ExitPool class is sketched 
(https://mail.python.org/archives/list/python-id...@python.org/message/66W55FRCYMYF73TVMDMWDLVIZK4ZDHPD/),
 which provides this removal of context managers.

What I learned is that this would have different cleanup mode (atexit style), 
as compared to present ExitStack cleanup (nested style). 

So contrary to what I was originally thinking ExitPool functionality would be 
close to, but not a strict superset of ExitStack functionality. Still such an 
ExitPool functionality would be extremely useful.

--

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



[issue46333] ForwardRef.__eq__ does not respect module parameter

2022-02-11 Thread Andreas H.


Change by Andreas H. :


--
pull_requests: +29443
pull_request: https://github.com/python/cpython/pull/31283

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



[issue41021] ctypes callback with structure crashes in Python 3.8 on Windows x86

2022-02-07 Thread Andreas Skaar


Andreas Skaar  added the comment:

Steve Dower do you have any links to the issues you mention? Are these now 
solved?

I am not able to see if the fix is straightforward, but from the information 
from Eryk Sun it sounds like it should be?

--

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



[issue46369] get_type_hints does not evaluate ForwardRefs inside NewType

2022-01-14 Thread Andreas H.


Andreas H.  added the comment:

Allright. B) sounds good to me. I dont think I have time today, so please feel 
to tackle the issue. If not I can look at it the next week.

--

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



[issue46373] TypedDict and NamedTuple do not evaluate cross-module ForwardRef in all cases

2022-01-14 Thread Andreas H.


New submission from Andreas H. :

TypedDict does not resolve cross-module ForwardRefs when the ForwardRef is not 
a direct one. 

In other words the fix GH-27017 (issue 41249) for TypedDict seems incomplete.

The same issue seem to exist for NamedTuple.



Example:

   #module.py
   TD = typing.TypedDict("TD", {'test': typing.List[typing.Optional['Y']]})
   class Y:
  pass


   # other module
   class TDSub(module.TD):
   a: int
   get_type_hints(TDSub)
   # -> Exception   NameError: Y not found


On the other hand, with direct ForwardRef, as e.g. in 
   TD = typing.TypedDict("TD", {'test':  'Y' } )

it works (that was indeed fixed by GH-27017)



Same issue exists for NamedTuple. There neither of the above works, i.e. 
cross-module ForwardRefs are never resolve (but they could - als NamedTuple has 
the __module__ member set with to calling module). I am not sure if inheritance 
for NamedTuple is supported so I do not know if it is really a bug. 


The problem in the code is that in TypedDict the `module` parameter is passed 
only onto the immediate ForwardRef. One option could be to recursively walk the 
type and search for unpatched ForwardRefs and set the module parameter.
On the other hand, the retroactive patching of forward refs is problematic as 
it may mess with the caching mechanism im typing.py. There may be a type with 
ForwardRef already in cache (and used by more than one user), but only for one 
user the `module` is to be updated. So probably a correct implementation is 
tricky, or some other way has to be found to update the `module` of ForwardRefs 
(e.g. by copying the type tree).


For NamedTuple the whole mechanism of passing the `module` parameter to the 
ForwardRefs is not done (not even for direct ForwardRef ones).


Not sure how important this (likely not very) is as I do not use TypedDict and 
NamedTuple. This is just to report it.

--
components: Library (Lib)
messages: 410547
nosy: AlexWaygood, Jelle Zijlstra, andreash, gvanrossum, kj, kumaraditya303, 
sobolevn
priority: normal
severity: normal
status: open
title: TypedDict and NamedTuple do not evaluate cross-module ForwardRef in all 
cases
type: behavior
versions: Python 3.10, Python 3.11

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



[issue46371] A better way to resolve ForwardRefs in type aliases across modules

2022-01-13 Thread Andreas H.


New submission from Andreas H. :

(De)Serialization of in-memory data structures is an important application. 
However there is a rather unpleasant issue with ForwardRefs.


One cannot export type aliases when they contain ForwardRefs (and expect 
things to work).


Consider the example:

Json = Union[ List['Json'], Dict[str, 'Json'], int, float, bool, None ]


When used in another module the containing ForwardRefs cannot be resolved, or 
in the worst case, resolve to 
wrong types if in the caller namespace contains a symbol with the same name as 
ForwardRef refers to.

This of course only applies to inspection-based tools which utilize the 
run-time information, not the static type checkers.


Type aliases sometimes have to be used sometimes - they cannot be avoided in 
all cases, 
especially with recursive types as in the example above.  



There are several options to improve the situation. These are all that came to 
my mind and I want to expose them to discussion.



1. Guard with NewType

Json = NewType('Json', Union[ List['Json'], Dict[str, 'Json'], int, float, 
bool, None ] )
   
   Advantage: This could allow automatic cross-module ForwardRef resolution 
provided issue 46369 [1] is acknowledged as a bug and fixed. 
   Disadvantage: Does not create a true type alias, but a sub-type. Type casts 
have to be used all the time, e.g.   `data = Json(bool)`.
  So can only applied to a subset of use-cases (but is IMO a clean solution 
when it fits). 


2. Use the `module` parameter of ForwardRef

Json = Union[ List[ForwardRef('Json', module=__name__)], Dict[str, 
ForwardRef('Json', module=__name__)], int, float, bool, None ] )

   Advantage: Works in 3.10. 
   Disadvantage: Would require issue 46333 [2] to be fixed. ForwardRef is not 
meant to be instatiated by the user, 
   also `module` parameter is currently completely internal.


3. Modify ForwardRef so that it accepts a fully qualified name

Json = Union[ List[__name__+'.Json'], Dict[str, __name__+'.Json'], int, 
float, bool, None ] )

   Advantage: This is only a tiny change (because ForwardRef has the `module` 
parameter). ForwardRef would stay internal. Less ugly than 2.
   Disadvantage: Still a bit ugly. Would also require issue 46333 [2] to be 
fixed. Relative module specification (as in relative imports) 
  would not work.


4. Manual evaluation

Json = Union[ List['Json'], Dict[str, 'Json'], int, float, bool, None ]
resolve_type_alias(Json, globals(), locals() )


def resolve_type_alias(type, globalns, localns):
class dummy:
test: type
typing.get_type_hints(dummy, globalns, localns) # Note: this modifies 
ForwardRefs in-place

Advantage: Works in many versions.
Disadvantage: Requires user to explicily call function after the last 
referenced type is defined 
   (this may be physically separated from the type alias definition, which 
does not feel like a good solution especially since 
this ForwardRef export problem is only technical, and not even close to 
beeing obvious to most people)


5. Make `get_type_hints()` to work with type-aliases (essentially integrate 
above `resolve_type_alias`). The return value 
   of get_type_hints() would be the same as argument, just with ForwardRefs 
in-place resolved. 
 
 Json = Union[ List['Json'], Dict[str, 'Json'], int, float, bool, None ]
 get_type_hints(Json, globals(), locals())
 
   Advantage: same as 4) but hides useful (but ugly) code
   Disadvantage: same as 4)


 
6. Make all types in typing (such as List, Dict, Union, etc...) to capture 
their calling module and pass this information to ForwardRef, when 
   one is to be created. Then already during construction of ForwardRef the 
`module` will be correctly set.

 Json = Union[ List['Json'], Dict[str, 'Json'], int, float, bool, None ]

   Advantage: This requires no user intervention. Things will "just work"
   Disadvantage: This is rather big change. It is incompatible with the caching 
used inside typing.py (the new __module__ parameter would 
   need to be taken into account in __hash__ and/or __eq__). And maybe has 
other issues I do not see at the moment.


7. Extend `TypeAlias` hint so it can be used in bracket  way similar to e.g. 
`Annotated`

 Json = TypeAlias[ Union[ List['Json'], Dict[str, 'Json'], int, float, 
bool, None ]  ]
   

   I know, presently it is supposed to be used as  `Json: TypeAlias = Union[ 
 ]`. But that is of no help at run-time, because
   the variable Json contains no run-time information. So even if TypeAlias 
would capture the calling module, 
   this information is not passed on to the variable `Json`. This is different 
for the bracket notation TypeAlias[ .. ]. 

   Advantage: Similar usage to Annotated. Would not require a big change such 
as in 4).
   Disadvantage: TypeAlias is not supposed to be used that way.


8. Introduce function to define a type alias, which sets 

[issue46369] get_type_hints does not evaluate ForwardRefs inside NewType

2022-01-13 Thread Andreas H.


New submission from Andreas H. :

Consider the following: 

NewT = typing.NewType("NewT", typing.List[typing.Optional['Z']] )

class Z:
pass


Now get_type_hints() does not resolve the ForwardRef within NewType (but it 
does so for TypedDict, dataclasses, NamedTuple).


Neither of the following works.

1)  
class dummy:
test: NewT

get_type_hints(test,None,None)

print( NewT.__supertype__.__args__[0].__args__[0]__.__forward_evaluated__ )
# --> False

Note: investigating the return value of get_type_hints does not change the 
outcome. 
get_type_hints() patches ForwardRefs in-place.


2) 
get_type_hints(NewT,None,None)
# --> TypeError   is not a module, class, method, or function



For Python 3.10+ a workaround exists, but requires access to implementation 
details of NewType:
  
   class dummy:
   test: NewT.__supertype__
   get_type_hints( dummy, globalns=sys.modules[NewT.__module__].__dict__, 
localns=None )


Possible solution could be 
 A) to extent `get_type_hints` to explicitly handle NewType (basically call 
_eval_type for the __supertype__ member).
That makes approach 2) work (but not 1)
 or B) to extend _eval_type() to handle process NewType as well. This would 
make 1) work (but not 2).

I guess, since NewType is supposed to be semantically a subclass of the 
referred type, 2) is probably the preferred approach, which would suggest A). 


Strictly speaking this issue exits in all Python versions that have NewType, 
but it is easier to fix in 3.10 because there NewType has the __module__ member.

--
components: Library (Lib)
messages: 410528
nosy: andreash, gvanrossum, kj
priority: normal
severity: normal
status: open
title: get_type_hints does not evaluate ForwardRefs inside NewType
type: behavior
versions: Python 3.10, Python 3.11

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



[issue46333] ForwardRef.__eq__ does not respect module parameter

2022-01-12 Thread Andreas H.


Andreas H.  added the comment:

Ah, let me add one point: PEP563  (-> `from __future__ import annotations`) is 
also not helping. 

Even with PEP563 enabled, the JSON example  

   Json = Union[ List['Json'], Dict[str, 'Json'], int, float, bool, None ]

needs to be written in exact the same way as without PEP563. In other words 
there are cases where `ForwardRef` cannot be avoided. And unforntunately these 
are the cases where we have the ForwardRef missing context issue.

--

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



[issue46333] ForwardRef.__eq__ does not respect module parameter

2022-01-12 Thread Andreas H.


Andreas H.  added the comment:

Yeah, sure. The use-case is (de)serialization. Right now I use the library 
cattr, but there are many others. 

If you are interested there is related discussion in the cattr board [1].


The original problem is how to define the types for serialization.

1. If everything is a class, things work well, but not if type aliases are 
used: 

2. Type aliases sometimes have to be used - they cannot be avoided in all 
cases, 
   especially with recursive types. The famous example is 

  Json = Union[ List['Json'], Dict[str, 'Json'], int, float, bool, None ]

   (Note: even though mypy does not support this construct, pylance meanwhile 
does [2])

3. `typing.Annotated` seems to be made for specifying additional information 
such as value ranges, right to be used
   in (de)serialization + validation contexts. Often these will just be type 
aliases (not used as class members). 
   Combination is possible with typing.NewType.


The problem is that the implicit `ForwardRef('Json')` cannot be automatically 
resolved (as it only a name with no context). 
There is really no way this could be handle inside a library such as cattr.  

When one wants to separate interface from implementation this issue is even 
more complicated. The module where the serialization function is called is 
typically different from the module with the type definition (This is probably 
more the norm than the exception)



The option I expored is to explicitly create the ForwardRef and specify the 
module parameter (even though I have to admit that I also did read that the 
ForwardRef is only for internal use). 
   
Json = Union[ List[ForwardRef(Json',module=__name__)], Dict[str, 
ForwardRef(Json',module=__name__)], int, float, bool, None ]

Ugly, but this is better than nothing.


A (worse) alternative is to do

Json = Union[ List['Json'], Dict[str, 'Json'], int, float, bool, None ]
typing._eval_type(Json, globals(), locals())

That works since it puts the ForwardRefs into "evaluated" state 
(self.__forward_value__ is then set)



A third, but future, alternative could be to automatically decompose the 
argument of ForwardRef into module and type. Then one could write

   Json = Union[ List[__name__+'.Json'], Dict[str, __name__+'.Json'], int, 
float, bool, None ]

and all above problems would be solved.

Then ForwardRef could stay internal and this is more readable. Even though, the 
static type checkers would need to understand `__name__+'TYPE'` constructs to 
be useful.


Anyhow, it would be nice to have a solution here.



[1]: https://github.com/python-attrs/cattrs/issues/201
[2]: 
https://devblogs.microsoft.com/python/pylance-introduces-five-new-features-that-enable-type-magic-for-python-developers/

--

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



[issue46333] ForwardRef.__eq__ does not respect module parameter

2022-01-10 Thread Andreas H.


Andreas H.  added the comment:

I will give it a try.

--

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



[issue46333] ForwardRef.__eq__ does not respect module parameter

2022-01-10 Thread Andreas H.


New submission from Andreas H. :

The __eq__ method of ForwardRef does not take into account the module 
parameter. 

However, ForwardRefs with dissimilar module parameters are referring to 
different types even if they have different name. Thus also the ForwardRef's 
with same name but different module, should not be considered equal.


Consider the following code


from typing import *

ZZ = Optional['YY'] 
YY = int

YY = Tuple[Optional[ForwardRef("YY", module=__name__)], int]
print( YY.__args__[0].__args__[0].__forward_module__ )
# this prints None, but should print __main__ (or whatever __name__ contains)


When the first ForwardRef is not created, the program behaves correctly

#ZZ = Optional['YY'] 
YY = int

YY = Tuple[Optional[ForwardRef("YY", module=__name__)], int]
print( YY.__args__[0].__args__[0].__forward_module__ )
# this prints __main__ (or whatever __name__ contains)



The issue is that the line `ZZ = Optional['YY']` creates a cache entry, which 
is re-used instead of the second definition `Optional[ForwardRef("YY", 
module=__name__)]` and thus shadows the different argument of ForwardRef.


This problem could be fixed if the __eq__ method of FowardRef also checks for 
module equality.

i.e. in ForwardRef.__eq__ in typing.py replace 

   return self.__forward_arg__ == other.__forward_arg__

with 

   return self.__forward_arg__ == other.__forward_arg__  and  
self.__forward__module__ == other.__forward__module__ 


Ideally, (and for consistency reasons) the `__repr__` method of `ForwardRef` 
would also include the module arg if it present:

Change:

def __repr__(self):
return f'ForwardRef({self.__forward_arg__!r})'

to 

def __repr__(self):
if self.__forward_module__ is None:
return f'ForwardRef({self.__forward_arg__!r})'
else:
return f'ForwardRef({self.__forward_arg__!r}, 
module={self.__forward__module!r})'

--
components: Library (Lib)
messages: 410221
nosy: andreash, gvanrossum, kj
priority: normal
severity: normal
status: open
title: ForwardRef.__eq__ does not respect module parameter
type: behavior
versions: Python 3.10, Python 3.9

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



[issue45712] so it not allowed

2021-11-04 Thread Andreas Ley

New submission from Andreas Ley :

https://docs.python.org/3.11/tutorial/controlflow.html
(and earlier versions) have the sentence:

An unpacking like **rest is also supported. (But **_ would be redundant, so it 
not allowed.)

Although I'm not a native speaker, I suppose this is missing a verb and should 
read:

… so it is not allowed

--
assignee: docs@python
components: Documentation
messages: 405714
nosy: Andy, docs@python
priority: normal
severity: normal
status: open
title: so it not allowed
versions: Python 3.11

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



[issue41021] ctypes callback with structure crashes in Python 3.8 on Windows x86

2021-09-27 Thread Andreas Skaar


Andreas Skaar  added the comment:

What is the next steps on this bug?

Have you created a bug with libffi if this is not working correctly eryksun? 
Sounds like you understand what the bug report need to contain.

On implementing a workaround in ctypes. Is this possible?

--
nosy: +xs_iceman

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



[issue45184] Add `pop` function to remove context manager from (Async)ExitStack

2021-09-13 Thread Andreas H.


Andreas H.  added the comment:

I see your point. But even with `pop` or `remove` it is still a stack or 
stack-like. In the normal case the context managers are still released in 
reverse order as they were added. Order cannot be changed arbitrarily.

There is just the additional function of removing a single context manager 
prematurely(e.g. for graceful error recovery and such). 

I would perhaps say that a stack is the "wrong" solution to the problem of 
"programmatically combining context managers" [this is from the official 
documentaion] in the first place. I write wrong in quotes because it is of 
course not really wrong, as one wants the reverse exit order. But to adequately 
address the dynamic case one needs in my opinion the ability to prematurely 
remove context managers. Otherwise the use is limited.

Reimplemeting the desired functionality with dicts or lists does not seem 
appealing to me as the code will be 90% the same to ExitStack. It will then 
also make ExitStack obsolete. So why not integrate it there?

The unsymmetry of being able to add context managers but not being able to 
remove them also seems odd to me.

--

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



[issue45184] Add `pop` function to remove context manager from (Async)ExitStack

2021-09-13 Thread Andreas H.


New submission from Andreas H. :

Currently it is not possible to remove context managers from an ExitStack (or 
AsyncExitStack). 


Workarounds are difficult and generally do accesses implementation details of 
(Async)ExitStack.
See e.g. https://stackoverflow.com/a/37607405. It could be done as follows:


class AsyncExitStackWithPop(contextlib.AsyncExitStack):
"""Same as AsyncExitStack but with pop, i.e. removal functionality"""
async def pop(self, cm):
callbacks = self._exit_callbacks
self._exit_callbacks = collections.deque()
found = None
while callbacks:
cb = callbacks.popleft()
if cb[1].__self__ == cm:
found = cb
else:
self._exit_callbacks.append(cb)
if not found:
raise KeyError("context manager not found")
if found[0]:
return found[1](None,None,None)
else:
return await found[1](None, None, None)

The alternative is re-implementation of ExitStack with pop functionality, but 
that is also very difficult to get right (especially with exceptions). Which is 
probably the reason why there is ExitStack in the library at all.


So I propose to augment (Async)ExitStack with a `pop` method like above or 
similar to the above.


Use-Cases:

An example is a component that manages several connections to network services. 
During run-time the network services might need to change (i.e. some be 
disconnected and some be connected according to business logic), or handle 
re-connection events (ie. graceful response to network errors).
It is not too hard to imagine more use cases.
Essentially every case where dynamic resource management is needed and where 
single resources are managable with python context managers.

--
components: Library (Lib)
messages: 401703
nosy: andreash, ncoghlan, yselivanov
priority: normal
severity: normal
status: open
title: Add `pop` function to remove context manager from (Async)ExitStack
type: enhancement
versions: Python 3.10, Python 3.11, Python 3.6, Python 3.7, Python 3.8, Python 
3.9

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



[issue44795] asyncio.run does not allow for graceful shutdown of main task

2021-07-31 Thread Andreas H.


New submission from Andreas H. :

The issue is that the main task (which was supplied to asyncio.run) has no 
chance to clean up its "own" sub-tasks and handle 
possible exceptions that occur during the sub-task clean up. It prevents a 
graceful shutdown.

There is no way to prevent the current printing of the "unhandled" exeption, 
even though the sub-task exception was catched by the main task. (See example 
below)


-- Current behavior --

When asyncio.run() receives an (unhanded) exception, all tasks are cancelled 
simultaneously. 

If any task generates an exception during its clean-up phase this is printed to 
the log, even though this exception is handled by the main task.


-- Expected behavior --

asyncio.run() should first cancel the main task, wait for it to complete its 
shutdown (and possible cancel its own sub-tasks, with exception catching), and 
*afterwards* cancel the remaining tasks.


-- Example Code --

For instance realize a graceful shutdown of a webserver when SIGTERM signal 
handler raises a SystemExit exception.




import os
import asyncio
import logging


async def main():

logging.basicConfig(level=logging.INFO)

async def sub_task():
logging.info('sub_task: enter')
try:
while True:
await asyncio.sleep(1)
logging.info('some_task: action')
finally:
logging.info('sub_task: cleanup')
await asyncio.sleep(3)
logging.info('sub_task: cleanup generates exception')
raise ValueError()
logging.info('sub_task: cleanup end')

task = asyncio.create_task(sub_task())
 
try:
while True:
await asyncio.sleep(1)
except Exception as e:
logging.info(f"Main: exception {repr(e)} received: something went 
wrong: cancelling sub-task")
task.cancel()
finally:
logging.info("Main: cleanup")
try:
await task
except Exception as e:
logging.info(f"Main: catched exception {repr(e)} from await 
sub_task")

try:
asyncio.run( main() )
except KeyboardInterrupt:
pass

-- Script Output with Ctrl+C manually generating an KeyboardInterrupt exception 
--


INFO:root:sub_task: enter
INFO:root:some_task: action
<--- CtrlC pressed here
INFO:root:Main: exception CancelledError() received: something went wrong: 
cancelling sub-task
INFO:root:Main: cleanup
INFO:root:sub_task: cleanup
INFO:root:sub_task: cleanup generates exception
INFO:root:Main: catched exception ValueError() from await sub_task
ERROR:asyncio:unhandled exception during asyncio.run() shutdown
task: .sub_task() done, defined at 
D:\Benutzer\projekte\iep\apps\data_player\_signals_test\test.py:10> 
exception=ValueError()>
Traceback (most recent call last):
  File 
"C:\Users\z0013xar\AppData\Local\Continuum\anaconda3\lib\asyncio\runners.py", 
line 43, in run
return loop.run_until_complete(main)
  File 
"C:\Users\z0013xar\AppData\Local\Continuum\anaconda3\lib\asyncio\base_events.py",
 line 574, in run_until_complete
self.run_forever()
  File 
"C:\Users\z0013xar\AppData\Local\Continuum\anaconda3\lib\asyncio\base_events.py",
 line 541, in run_forever
self._run_once()
  File 
"C:\Users\z0013xar\AppData\Local\Continuum\anaconda3\lib\asyncio\base_events.py",
 line 1750, in _run_once
event_list = self._selector.select(timeout)
  File "C:\Users\z0013xar\AppData\Local\Continuum\anaconda3\lib\selectors.py", 
line 323, in select
r, w, _ = self._select(self._readers, self._writers, [], timeout)
  File "C:\Users\z0013xar\AppData\Local\Continuum\anaconda3\lib\selectors.py", 
line 314, in _select
r, w, x = select.select(r, w, w, timeout)
KeyboardInterrupt

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\Benutzer\projekte\iep\apps\data_player\_signals_test\test.py", line 
14, in sub_task
await asyncio.sleep(1)
  File 
"C:\Users\z0013xar\AppData\Local\Continuum\anaconda3\lib\asyncio\tasks.py", 
line 595, in sleep
return await future
concurrent.futures._base.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\Benutzer\projekte\iep\apps\data_player\_signals_test\test.py", line 
34, in main
await task
  File "D:\Benutzer\projekte\iep\apps\data_player\_signals_test\test.py", line 
20, in sub_task
raise ValueError()
ValueError

-- Expected Output --

Same as above but without

  "ERROR:asyncio:unhandled exception during asyncio.run() shutdown"

and following traceback

--
components: asyncio
messages: 398638
nosy: andreash, asvetlov, yselivanov
priority: normal
severity: normal
status: o

[issue44211] Duplicate '.bmp' key in mimetypes.py, maps to both 'image/bmp' and 'image/x-ms-bmp'

2021-05-21 Thread Andreas Jansson


Change by Andreas Jansson :


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

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



[issue44211] Duplicate '.bmp' key in mimetypes.py, maps to both 'image/bmp' and 'image/x-ms-bmp'

2021-05-21 Thread Andreas Jansson


New submission from Andreas Jansson :

The mime type of .bmp was changed from image/x-ms-bmp in 
https://github.com/python/cpython/pull/4756.

https://github.com/python/cpython/pull/3062 then re-introduced image/x-ms-bmp 
while keeping the newer image/bmp mapping.

--
components: Library (Lib)
messages: 394157
nosy: andreasjansson
priority: normal
severity: normal
status: open
title: Duplicate '.bmp' key in mimetypes.py, maps to both 'image/bmp' and 
'image/x-ms-bmp'
type: behavior
versions: Python 3.10, Python 3.8, Python 3.9

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



Immutable view classes - inherit from dict or from Mapping?

2021-04-12 Thread Andreas R Maier
Hi,
I have written some classes that represent immutable views on collections (see 
"immutable-views" package on Pypi).

Currently, these view classes inherit from the abstract collection classes such 
as Mapping, Sequence, Set. However, they implement the read-only methods of 
dict, list and set, which provides some more methods compared to the abstract 
collection classes. For example, class "dict" provides copy() or __reversed__() 
and the newer OR-operator methods all of which are not defined on the abstract 
class "Mapping".

Note that the view classes do not provide any of the modifying methods of 
"dict" and "list", because after all the views are supposed to be immutable.

My question is, should the dict view class inherit from Mapping or from dict, 
and likewise, should the list view class inherit from Sequence or from list?

Thanks
Andy

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


[issue43643] importlib.readers.MultiplexedPath.name is not a property

2021-03-27 Thread Andreas Poehlmann


New submission from Andreas Poehlmann :

Hello,

I was using the `importlib_resources` backport and encountered this issue, 
which is also present in cpython:

`importlib.readers.MultiplexedPath.name` is not a property as required by 
`importlib.abc.Traversable` 


I can prepare a pull request if it helps.

Cheers,
Andreas

--
components: Library (Lib)
messages: 389615
nosy: ap--, jaraco
priority: normal
severity: normal
status: open
title: importlib.readers.MultiplexedPath.name is not a property
type: behavior
versions: Python 3.10

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



[issue42876] '''"""''' != '""""'

2021-01-09 Thread Andreas Zeller


New submission from Andreas Zeller :

The following line of code fails in Python 3.6, which I find surprising.

>>> assert '''"""''' == '""""'  # Fails

Note that the following all pass as expected:

>>> assert """'''""" == "'''"  # Passes
>>> assert '''""''' == '""'  # Passes

--
components: Interpreter Core
messages: 384736
nosy: andreas-zeller
priority: normal
severity: normal
status: open
title: '''"""''' != '""""'
type: behavior
versions: Python 3.6

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



[issue42487] collections.ChainMap.__iter__ calls __getitem__ on underlying maps

2020-11-27 Thread Andreas Poehlmann


Change by Andreas Poehlmann :


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

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



[issue42487] collections.ChainMap.__iter__ calls __getitem__ on underlying maps

2020-11-27 Thread Andreas Poehlmann


New submission from Andreas Poehlmann :

Hello,

I encountered an issue with collections.ChainMap, that was introduced when 
https://bugs.python.org/issue32792 got fixed.

Iterating a ChainMap will call __getitem__ on its underlying maps:


>>> from collections import UserDict, ChainMap
>>> class MyDict(UserDict):
... def __getitem__(self, k):
... print("expensive computation", k)
... return super().__getitem__(k)
... 
>>> set(ChainMap(MyDict(a=1, b=2, c=3)))
expensive computation a
expensive computation b
expensive computation c
{'c', 'b', 'a'}

--
components: Library (Lib)
messages: 381971
nosy: ap--
priority: normal
severity: normal
status: open
title: collections.ChainMap.__iter__ calls __getitem__ on underlying maps
type: behavior
versions: Python 3.10, Python 3.7, Python 3.8, Python 3.9

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



[issue41529] Unable to compile 3.0b3 on Ubuntu systems: Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding

2020-08-12 Thread Andreas Jung


New submission from Andreas Jung :

Building 3.9.0b3 fails on Ubuntu 19 and 20 in same way:

./python -E -S -m sysconfig --generate-posix-vars ;\
if test $? -ne 0 ; then \
echo "generate-posix-vars failed" ; \
rm -f ./pybuilddir.txt ; \
exit 1 ; \
fi
Could not find platform independent libraries 
Could not find platform dependent libraries 
Consider setting $PYTHONHOME to [:]
Python path configuration:
  PYTHONHOME = (not set)
  PYTHONPATH = (not set)
  program name = './python'
  isolated = 0
  environment = 0
  user site = 1
  import site = 0
  sys._base_executable = '/home/ajung/src/pp.server/Python-3.9.0b3/python'
  sys.base_prefix = '/opt/python-3.9.0b3'
  sys.base_exec_prefix = '/opt/python-3.9.0b3'
  sys.platlibdir = 'lib'
  sys.executable = '/home/ajung/src/pp.server/Python-3.9.0b3/python'
  sys.prefix = '/opt/python-3.9.0b3'
  sys.exec_prefix = '/opt/python-3.9.0b3'
  sys.path = [
'/opt/python-3.9.0b3/lib/python39.zip',
'/opt/python-3.9.0b3/lib/python3.9',
'/opt/python-3.9.0b3/lib/lib-dynload',
  ]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the 
filesystem encoding
Python runtime state: core initialized
ModuleNotFoundError: No module named 'encodings'

Current thread 0x7f824c25c280 (most recent call first):

generate-posix-vars failed
make: *** [Makefile:612: pybuilddir.txt] Error 1

--
components: Build
messages: 375216
nosy: ajung
priority: normal
severity: normal
status: open
title: Unable to compile 3.0b3 on Ubuntu systems: Fatal Python error: 
init_fs_encoding: failed to get the Python codec of the filesystem encoding
versions: Python 3.9

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



[issue40372] doctest example programs should exit 1 if any test fails

2020-04-23 Thread Andreas Sommer


New submission from Andreas Sommer :

Documentation recommends calling `doctest.testmod()`, but exits with code 0 
even if a test fails.

--
assignee: docs@python
components: Documentation
messages: 367086
nosy: Andreas Sommer, docs@python
priority: normal
severity: normal
status: open
title: doctest example programs should exit 1 if any test fails
type: enhancement
versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9

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



[issue40052] Incorrect pointer alignment in _PyVectorcall_Function() of cpython/abstract.h

2020-03-24 Thread Andreas Schneider


Andreas Schneider  added the comment:

I forgot, for detecting alignment issues or strict aliasing and this also falls 
under strict aliasing, you need to turn on optimizations.

clang -O2 -Werror -Wcast-align ...

--

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



[issue40052] Incorrect pointer alignment in _PyVectorcall_Function() of cpython/abstract.h

2020-03-24 Thread Andreas Schneider


Andreas Schneider  added the comment:

clang -Werror -Wcast-align ...

rpm -q clang9
clang9-9.0.1-8.1.x86_64

Does that help? Found in CI of

https://gitlab.com/cwrap/pam_wrapper

--

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



[issue40052] Incorrect pointer alignment in _PyVectorcall_Function() of cpython/abstract.h

2020-03-24 Thread Andreas Schneider


Change by Andreas Schneider :


--
type:  -> compile error
versions: +Python 3.8

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



[issue40052] Incorrect pointer alignment in _PyVectorcall_Function() of cpython/abstract.h

2020-03-24 Thread Andreas Schneider


New submission from Andreas Schneider :

In file included from /builds/cryptomilk/pam_wrapper/src/python/pypamtest.c:21:
In file included from /usr/include/python3.8/Python.h:147:
In file included from /usr/include/python3.8/abstract.h:837:
/usr/include/python3.8/cpython/abstract.h:91:11: error: cast from 'char *' to 
'vectorcallfunc *' (aka 'struct _object *(**)(struct _object *, struct _object 
*const *, unsigned long, struct _object *)') increases required alignment from 
1 to 8 [-Werror,-Wcast-align]
ptr = (vectorcallfunc*)(((char *)callable) + offset);
  ^~
1 error generated.


The correct way to do it would be:

union {
   char *data;
   vectorcallfunc *ptr;
} vc;

vc.data = (char *)callable + offset;
return *vc.ptr;

--
components: C API
messages: 364919
nosy: asn
priority: normal
severity: normal
status: open
title: Incorrect pointer alignment in _PyVectorcall_Function() of 
cpython/abstract.h

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



[issue39876] csv.DictReader.fieldnames interprets unicode as ascii

2020-03-06 Thread Andreas Spar

New submission from Andreas Spar :

with open(filename, "rt") as csvfile:
csv_reader = csv.DictReader(csvfile, delimiter=csv_delimiter)
filednames = csv_reader.fieldnames

In Python 3.8 csv expects utf-8 encoded files but apperently doens't read the 
header with utf-8 format.
If the csv file has an header named 'Französisch' it will be saved as 
'Französisch'.

--
components: Library (Lib)
messages: 363506
nosy: sparan
priority: normal
severity: normal
status: open
title: csv.DictReader.fieldnames interprets unicode as ascii
type: compile error
versions: Python 3.8

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



[issue21161] list comprehensions don't see local variables in pdb in python3

2019-12-05 Thread Andreas Kloeckner


Change by Andreas Kloeckner :


--
nosy: +inducer

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



[issue34224] python 3.7 inside venv tries to write back to read-only installation directory (Grammar3.7.0.final.0.pickle)

2019-07-21 Thread Andreas Jung


Andreas Jung  added the comment:

This issue is still true for 3.8.0b1, Ubuntu 19.04, umask is 0077, Python 3.8 
is installed using "sudo make install".

!bin/python
bin/python setup.py develop
running develop
running egg_info
writing fs.webdavfs.egg-info/PKG-INFO
writing dependency_links to fs.webdavfs.egg-info/dependency_links.txt
writing entry points to fs.webdavfs.egg-info/entry_points.txt
writing requirements to fs.webdavfs.egg-info/requires.txt
writing top-level names to fs.webdavfs.egg-info/top_level.txt
error: [Errno 13] Permission denied: 
'/opt/python-3.8.0b1/lib/python3.8/lib2to3/Grammar3.8.0.beta.1.pickle'


So "python3 -m venv" should setup a virtualenv properly without the need 
writing anything to the Python installation directory. Or it is up to "make 
install" to generate the related files properly during installation.

--

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



[issue37402] Fatal Python error: Cannot recover from stack overflow issues on Python 3.6 and 3.7

2019-06-25 Thread Andreas Jung


Andreas Jung  added the comment:

Typical traceback:

WARNING:plone.app.contenttypes.indexers:Lookup of PrimaryField failed for 
http://nohost/plone_portal/microscopycentre/img/fotos-specialist-course2018.htm/demo10-jpg
 If renaming or importing please reindex!
WARNING:plone.app.contenttypes.indexers:Lookup of PrimaryField failed for 
http://nohost/plone_portal/microscopycentre/img/fotos-specialist-course2018.htm/kick-off2-jpg
 If renaming or importing please reindex!
WARNING:plone.app.contenttypes.indexers:Lookup of PrimaryField failed for 
http://nohost/plone_portal/microscopycentre/img/fotos-specialist-course2018.htm/kick-off3-jpg
 If renaming or importing please reindex!
WARNING:plone.app.contenttypes.indexers:Lookup of PrimaryField failed for 
http://nohost/plone_portal/microscopycentre/img/fotos-specialist-course2018.htm/kick-off6-jpg
 If renaming or importing please reindex!
WARNING:plone.app.contenttypes.indexers:Lookup of PrimaryField failed for 
http://nohost/plone_portal/microscopycentre/img/fotos-specialist-course2018.htm/kick-off5-jpg
 If renaming or importing please reindex!
WARNING:plone.app.contenttypes.indexers:Lookup of PrimaryField failed for 
http://nohost/plone_portal/microscopycentre/img/toon-jpg If renaming or 
importing please reindex!
WARNING:plone.app.contenttypes.indexers:Lookup of PrimaryField failed for 
http://nohost/plone_portal/microscopycentre/img/wf.htm If renaming or importing 
please reindex!
WARNING:plone.app.contenttypes.indexers:Lookup of PrimaryField failed for 
http://nohost/plone_portal/microscopycentre/img/toon.htm If renaming or 
importing please reindex!
WARNING:plone.app.contenttypes.indexers:Lookup of PrimaryField failed for 
http://nohost/plone_portal/microscopycentre/img/unite.htm If renaming or 
importing please reindex!
WARNING:plone.app.contenttypes.indexers:Lookup of PrimaryField failed for 
http://nohost/plone_portal/microscopycentre/img/spt If renaming or importing 
please reindex!
WARNING:plone.app.contenttypes.indexers:Lookup of PrimaryField failed for 
http://nohost/plone_portal/openuniversiteit/nl/contact/studiegids2015.pdf If 
renaming or importing please reindex!
WARNING:plone.app.contenttypes.indexers:Lookup of PrimaryField failed for 
http://nohost/plone_portal/openuniversiteit/nl/contact/studiegids2015.pdf If 
renaming or importing please reindex!
Fatal Python error: Cannot recover from stack overflow.

Thread 0x7fe43f8b0700 (most recent call first):
  File "/opt/python-3.7.3/lib/python3.7/selectors.py", line 468 in select
  File "/opt/python-3.7.3/lib/python3.7/asyncio/base_events.py", line 1739 in 
_run_once
  File "/opt/python-3.7.3/lib/python3.7/asyncio/base_events.py", line 539 in 
run_forever
  File 
"/home/ajung/sandboxes/ugent-portaal-plone-4x/eggs/ZEO-5.2.1-py3.7.egg/ZEO/asyncio/client.py",
 line 861 in run
  File "/opt/python-3.7.3/lib/python3.7/threading.py", line 865 in run
  File "/opt/python-3.7.3/lib/python3.7/threading.py", line 917 in 
_bootstrap_inner
  File "/opt/python-3.7.3/lib/python3.7/threading.py", line 885 in _bootstrap

Current thread 0x7fe44e046500 (most recent call first):
  File 
"/home/ajung/sandboxes/ugent-portaal-plone-4x/eggs/zope.component-4.5-py3.7.egg/zope/component/hooks.py",
 line 103 in getSiteManager
  File 
"/home/ajung/sandboxes/ugent-portaal-plone-4x/eggs/zope.component-4.5-py3.7.egg/zope/component/_api.py",
 line 157 in queryUtility
  File 
"/home/ajung/sandboxes/ugent-portaal-plone-4x/eggs/Products.CMFCore-2.4.0b8-py3.7.egg/Products/CMFCore/DynamicType.py",
 line 71 in getTypeInfo
  File 
"/home/ajung/sandboxes/ugent-portaal-plone-4x/eggs/Products.CMFDynamicViewFTI-6.0.1-py3.7.egg/Products/CMFDynamicViewFTI/browserdefault.py",
 line 96 in getLayout
  File 
"/home/ajung/sandboxes/ugent-portaal-plone-4x/eggs/Products.CMFDynamicViewFTI-6.0.1-py3.7.egg/Products/CMFDynamicViewFTI/browserdefault.py",
 line 75 in __call__
  File 
"/home/ajung/sandboxes/ugent-portaal-plone-4x/eggs/Products.CMFDynamicViewFTI-6.0.1-py3.7.egg/Products/CMFDynamicViewFTI/browserdefault.py",
 line 76 in __call__
  File 
"/home/ajung/sandboxes/ugent-portaal-plone-4x/eggs/Products.CMFDynamicViewFTI-6.0.1-py3.7.egg/Products/CMFDynamicViewFTI/browserdefault.py",
 line 76 in __call__
  File 
"/home/ajung/sandboxes/ugent-portaal-plone-4x/eggs/Products.CMFDynamicViewFTI-6.0.1-py3.7.egg/Products/CMFDynamicViewFTI/browserdefault.py",
 line 76 in __call__
  File 
"/home/ajung/sandboxes/ugent-portaal-plone-4x/eggs/Products.CMFDynamicViewFTI-6.0.1-py3.7.egg/Products/CMFDynamicViewFTI/browserdefault.py",
 line 76 in __call__
  File 
"/home/ajung/sandboxes/ugent-portaal-plone-4x/eggs/Products.CMFDynamicViewFTI-6.0.1-py3.7.egg/Products/CMFDynamicViewFTI/browserdefault.py",
 line 76 in __call__
  File 
"/home/ajung/sandboxes/ugent-portaal-plone-4x

[issue37402] Fatal Python error: Cannot recover from stack overflow issues on Python 3.6 and 3.7

2019-06-25 Thread Andreas Jung


New submission from Andreas Jung :

I am using Python 3.6 and 3.7 (always latest minor releases) with Plone 5.2 and 
I various issues with 

Fatal Python error: Cannot recover from stack overflow.

and do not make much sense to me.

Some related tracebacks are documented here

https://github.com/plone/Products.CMFPlone/issues/2874

https://community.plone.org/t/fatal-python-error-cannot-recover-from-stack-overflow/8589

There are no patterns directly visible what may typically cause the error. 

The errors occur at least with Python 3.6 system Python on Fedora 26 and a 
self-compiled Python 3.7.3 on a fresh Debian 9 system.

--
components: Interpreter Core
messages: 346521
nosy: ajung
priority: normal
severity: normal
status: open
title: Fatal Python error: Cannot recover from stack overflow issues on Python 
3.6 and 3.7
type: crash
versions: Python 3.6, Python 3.7

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



[issue34606] Unable to read zip file with extra

2019-06-25 Thread Andreas Gäer

Andreas Gäer  added the comment:

I'm a little bit puzzled that this bug is closed as "not a bug" despite the 
fact that all versions of python allow the user to create "invalid" ZIP files 
and all version up to 3.7 are able to read those "invalid" files.

Currently we're stuck with a lot of already created ZIP files that cannot be 
read or fixed after an update to 3.7.

Would it be an option to make decoding of extra data optional eg. with an extra 
keyword arg to __init__?

--
nosy: +Andreas.Gäer

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



[issue37361] urllib3: TypeError: unsupported operand type(s) for -=: 'Session' and 'int' in Retry class

2019-06-21 Thread Andreas Jung


Andreas Jung  added the comment:

invalid

--

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



[issue37361] urllib3: TypeError: unsupported operand type(s) for -=: 'Session' and 'int' in Retry class

2019-06-21 Thread Andreas Jung


Change by Andreas Jung :


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

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



[issue37361] urllib3: TypeError: unsupported operand type(s) for -=: 'Session' and 'int' in Retry class

2019-06-21 Thread Andreas Jung


New submission from Andreas Jung :

Python 3.7.3

The following code is support to add a retry to the requests module.

"total" is correctly initialized with 5 here but internally self.total becomes 
an instation of "Session"


import requests
from requests.adapters import HTTPAdapter
from requests.packages.urllib3.util.retry import Retry


def requests_retry_session(
retries=5,
backoff_factor=5,
status_forcelist=(500, 502, 504),
):
session = requests.Session()
retry = Retry(
total=retries,
backoff_factor=backoff_factor,
status_forcelist=status_forcelist,
)
import pdb; pdb.set_trace()
print(retry.total)
adapter = HTTPAdapter(max_retries=retry)
session.mount('http://', adapter)
session.mount('https://', adapter)
return session


s = requests.Session()
response = requests_retry_session(s).get('https://www.foo.com/')
print(response.status_code)

Traceback (most recent call last):
  File 
"/home/ajung/sandboxes/ugent-portaal-plone-4x/eggs/urllib3-1.24.2-py3.7.egg/urllib3/connectionpool.py",
 line 600, in urlopen
chunked=chunked)
  File 
"/home/ajung/sandboxes/ugent-portaal-plone-4x/eggs/urllib3-1.24.2-py3.7.egg/urllib3/connectionpool.py",
 line 343, in _make_request
self._validate_conn(conn)
  File 
"/home/ajung/sandboxes/ugent-portaal-plone-4x/eggs/urllib3-1.24.2-py3.7.egg/urllib3/connectionpool.py",
 line 839, in _validate_conn
conn.connect()
  File 
"/home/ajung/sandboxes/ugent-portaal-plone-4x/eggs/urllib3-1.24.2-py3.7.egg/urllib3/connection.py",
 line 344, in connect
ssl_context=context)
  File 
"/home/ajung/sandboxes/ugent-portaal-plone-4x/eggs/urllib3-1.24.2-py3.7.egg/urllib3/util/ssl_.py",
 line 347, in ssl_wrap_socket
return context.wrap_socket(sock, server_hostname=server_hostname)
  File "/opt/python-3.7.3/lib/python3.7/ssl.py", line 412, in wrap_socket
session=session
  File "/opt/python-3.7.3/lib/python3.7/ssl.py", line 853, in _create
self.do_handshake()
  File "/opt/python-3.7.3/lib/python3.7/ssl.py", line 1117, in do_handshake
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate 
verify failed: self signed certificate (_ssl.c:1056)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "bin/zopepy", line 303, in 
exec(compile(__file__f.read(), __file__, "exec"))
  File "foo.py", line 28, in 
response = requests_retry_session(s).get('https://www.foo.com/')
  File 
"/home/ajung/sandboxes/ugent-portaal-plone-4x/eggs/requests-2.21.0-py3.7.egg/requests/sessions.py",
 line 546, in get
return self.request('GET', url, **kwargs)
  File 
"/home/ajung/sandboxes/ugent-portaal-plone-4x/eggs/requests-2.21.0-py3.7.egg/requests/sessions.py",
 line 533, in request
resp = self.send(prep, **send_kwargs)
  File 
"/home/ajung/sandboxes/ugent-portaal-plone-4x/eggs/requests-2.21.0-py3.7.egg/requests/sessions.py",
 line 646, in send
r = adapter.send(request, **kwargs)
  File 
"/home/ajung/sandboxes/ugent-portaal-plone-4x/eggs/requests-2.21.0-py3.7.egg/requests/adapters.py",
 line 449, in send
timeout=timeout
  File 
"/home/ajung/sandboxes/ugent-portaal-plone-4x/eggs/urllib3-1.24.2-py3.7.egg/urllib3/connectionpool.py",
 line 638, in urlopen
_stacktrace=sys.exc_info()[2])
  File 
"/home/ajung/sandboxes/ugent-portaal-plone-4x/eggs/urllib3-1.24.2-py3.7.egg/urllib3/util/retry.py",
 line 348, in increment
total -= 1
TypeError: unsupported operand type(s) for -=: 'Session' and 'int'

--
components: Library (Lib)
messages: 346208
nosy: ajung
priority: normal
severity: normal
status: open
title: urllib3: TypeError: unsupported operand type(s) for -=: 'Session' and 
'int' in Retry class
versions: Python 3.7

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



[issue36699] building for riscv multilib (patch attached)

2019-05-02 Thread Andreas K . Hüttel

Andreas K. Hüttel  added the comment:

Who am I to disagree.

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

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



[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2019-04-30 Thread Andreas Schneider


Andreas Schneider  added the comment:

And how do you deal with METH_VARARGS|METH_KEYWORDS functions which have 3 
arguments?

PyObject* myfunc(PyObject *py_obj, PyObject *args, PyObject *kwargs)

--

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



[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2019-04-30 Thread Andreas Schneider


Andreas Schneider  added the comment:

Looking at:

https://github.com/python/cpython/commit/359a2f3daba49fde0d3a07fb3c7a8b051c450d08

This is not fixing the underlying issue but hiding it. The right fix would be 
to use a union for ml_meth providing members for the 3 different function. So 
the developer could assign them correctly and the compiler would warn if he 
would do something wrong. Casting to (void *) is just hiding the problem not 
fixing it!

--
nosy: +asn

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



[issue36699] building for riscv multilib (patch attached)

2019-04-22 Thread Andreas K . Hüttel

New submission from Andreas K. Hüttel :

Hi. I have been trying to install Python on a (well prototype of a) risc-v 
multilib Gentoo system, where the system library directory is /usr/lib64/lp64d 
(!).

See as reference for the directories
https://www.sifive.com/blog/all-aboard-part-5-risc-v-multilib

Python as is builds and installs fine but the results are pretty much 
unuseable. Symptoms are "/usr/lib64/lib64/lp64d/python3.6/site-packages" 
directory name and distutils installs unable to find Python.h  (it is correctly 
installed in /usr/include/..., but distutils passes /usr/lib64/include as 
include path).

I've tracked this down to bad values in sys.base_prefix and sys.exec_prefix:

 >>> sys.base_prefix
 '/usr/lib/python-exec/python3.6/../../../lib64'

Even if I set PYTHONHOME=/usr , I get '/usr/lib64'

The fix, specific for this directory layout, is to have one more directory 
component stripped in Modules/getpath.c , see patch below. 
With this I have been able to install Python with a normal-looking directory 
layout, and distutils things install fine.

Posting this here so it gets your attention, and hoping that you're better in 
coming up with a general solution than I am... probably the number of 
components stripped should depend on the number of slashes in the library path, 
e.g., "lib" versus "lib64/lp64d"

diff -ruN Python-3.6.8.orig/Modules/getpath.c Python-3.6.8/Modules/getpath.c
--- Python-3.6.8.orig/Modules/getpath.c 2018-12-23 22:37:14.0 +0100
+++ Python-3.6.8/Modules/getpath.c  2019-04-21 01:05:35.127440301 +0200
@@ -796,6 +796,7 @@
 if (pfound > 0) {
 reduce(prefix);
 reduce(prefix);
+reduce(prefix);
 /* The prefix is the root directory, but reduce() chopped
  * off the "/". */
 if (!prefix[0])
@@ -808,6 +809,7 @@
 reduce(exec_prefix);
 reduce(exec_prefix);
 reduce(exec_prefix);
+reduce(exec_prefix);
 if (!exec_prefix[0])
 wcscpy(exec_prefix, separator);
 }


Thanks.

------
components: Build
messages: 340667
nosy: Andreas K. Hüttel
priority: normal
severity: normal
status: open
title: building for riscv multilib (patch attached)
type: enhancement
versions: Python 3.8

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



[issue17267] datetime.time support for '+' and '-'

2019-04-13 Thread Andreas Åkerlund

Change by Andreas Åkerlund :


--
nosy:  -thezulk

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



[issue35847] RISC-V needs CTYPES_PASS_BY_REF_HACK

2019-01-29 Thread Andreas Schwab


Change by Andreas Schwab :


--
keywords: +patch, patch, patch
pull_requests: +11536, 11537, 11538
stage:  -> patch review

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



[issue35847] RISC-V needs CTYPES_PASS_BY_REF_HACK

2019-01-29 Thread Andreas Schwab


Change by Andreas Schwab :


--
keywords: +patch, patch
pull_requests: +11536, 11537
stage:  -> patch review

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



[issue35847] RISC-V needs CTYPES_PASS_BY_REF_HACK

2019-01-29 Thread Andreas Schwab


Change by Andreas Schwab :


--
keywords: +patch
pull_requests: +11536
stage:  -> patch review

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



[issue35847] RISC-V needs CTYPES_PASS_BY_REF_HACK

2019-01-29 Thread Andreas Schwab


New submission from Andreas Schwab :

==
FAIL: test_pass_by_value (ctypes.test.test_structures.StructureTestCase)
--
Traceback (most recent call last):
  File 
"/home/abuild/rpmbuild/BUILD/Python-3.7.2/Lib/ctypes/test/test_structures.py", 
line 416, in test_pass_by_value
self.assertEqual(s.first, 0xdeadbeef)
AssertionError: 195948557 != 3735928559

--

--
components: ctypes
messages: 334505
nosy: schwab
priority: normal
severity: normal
status: open
title: RISC-V needs CTYPES_PASS_BY_REF_HACK
type: behavior
versions: Python 3.7, Python 3.8

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



[issue35818] test_email: test_localtime_daylight_false_dst_true() fails if timezone database is missing

2019-01-24 Thread Andreas Schwab


Andreas Schwab  added the comment:

rpm -e timezone

--

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



[issue35818] test_email: test_localtime_daylight_false_dst_true() fails if timezone database is missing

2019-01-24 Thread Andreas Schwab


New submission from Andreas Schwab :

bpo-35317 solution is incomplete, the test needs to be skipped if the timezone 
database is unavailable.

--
messages: 334294
nosy: barry, miss-islington, p-ganssle, r.david.murray, schwab, vstinner, xtreak
priority: normal
severity: normal
status: open
title: test_email: test_localtime_daylight_false_dst_true() fails if timezone 
database is missing
type: behavior
versions: Python 3.6, Python 3.7, Python 3.8

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



[issue35317] test_email: test_localtime_daylight_false_dst_true() fails depending on the timezone

2019-01-24 Thread Andreas Schwab


Andreas Schwab  added the comment:

The test still fails if the timezone database is not available.

--
nosy: +schwab

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



[issue25296] Simple End-of-life guide covering all unsupported versions

2018-09-15 Thread Andreas Lutro


Andreas Lutro  added the comment:

I see this has been closed, but the page on the devguide is still really hard 
to find. On the python IRC channel I often see questions about this and I 
always have a hard time finding the page with the correct information.

If I google "python version support" or "python version end of life" or "python 
version lifecycle" I don't arrive at that page. For some of these searches I 
even end up on a separate devcycle[1] page which only contains old versions of 
python. Compare that to PHP, where the official "supported versions" page is 
the top result no matter what I search for.

Nevermind the fact that the lifecycle of python versions is relevant to 
non-developers as well, making it un-intuitive to go to the devguide to find 
this information.

I really think this needs to be made part of python.org's main website, with 
some good SEO.

[1] https://devguide.python.org/devcycle/

--
nosy: +Andreas Lutro

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



[issue34224] python 3.7 inside venv tries to write back to read-only installation directory (Grammar3.7.0.final.0.pickle)

2018-07-25 Thread Andreas Jung


New submission from Andreas Jung :

I installed Python 3.7.0 from source inside /opt/python-3.7.0 (make install as 
root).

Then I created a virtual environment for a package and tried to develop the 
package.
Python 3.7.0 tries to create a file

/opt/python-3.7.0/lib/python3.7/lib2to3/Grammar3.7.0.final.0.pickle

which fails obviously because the installation directory is owned by root and 
is not writable for an normal user account

(my-3.7) ajung@dev ~/src/zopyx.txng3.ext (master) $ 
/opt/python-3.7.0/bin/python3 -m venv .

(my-3.7) ajung@dev ~/src/zopyx.txng3.ext (master) $ bin/python
Python 3.7.0 (default, Jul 25 2018, 16:08:13) 
[GCC 7.3.1 20180130 (Red Hat 7.3.1-2)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 


(my-3.7) ajung@dev ~/src/zopyx.txng3.ext (master) $ bin/python setup.py develop
running develop
running egg_info
writing zopyx.txng3.ext.egg-info/PKG-INFO
writing dependency_links to zopyx.txng3.ext.egg-info/dependency_links.txt
writing namespace_packages to zopyx.txng3.ext.egg-info/namespace_packages.txt
writing requirements to zopyx.txng3.ext.egg-info/requires.txt
writing top-level names to zopyx.txng3.ext.egg-info/top_level.txt
error: [Errno 13] Permission denied: 
'/opt/python-3.7.0/lib/python3.7/lib2to3/Grammar3.7.0.final.0.pickle'

--
title: python 3.7 inside venv tries to write back to installation directory -> 
python 3.7 inside venv tries to write back to read-only installation directory 
(Grammar3.7.0.final.0.pickle)
versions: +Python 3.7

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



[issue34224] python 3.7 inside venv tries to write back to installation directory

2018-07-25 Thread Andreas Jung


Change by Andreas Jung :


--
components: Installation
nosy: ajung
priority: normal
severity: normal
status: open
title: python 3.7 inside venv tries to write back to installation directory

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



[issue33142] Fatal Python error: Py_Initialize: Unable to get the locale encoding on Debian/Python 3.6.4 source build

2018-03-26 Thread Andreas Jung

Change by Andreas Jung <aj...@users.sourceforge.net>:


--
components: +Installation

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33142>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33142] Fatal Python error: Py_Initialize: Unable to get the locale encoding on Debian/Python 3.6.4 source build

2018-03-26 Thread Andreas Jung

Change by Andreas Jung <aj...@users.sourceforge.net>:


--
title: Fatal Python error: Py_Initialize: Unable to get the locale encoding -> 
Fatal Python error: Py_Initialize: Unable to get the locale encoding on 
Debian/Python 3.6.4 source build

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33142>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33142] Fatal Python error: Py_Initialize: Unable to get the locale encoding

2018-03-26 Thread Andreas Jung

New submission from Andreas Jung <aj...@users.sourceforge.net>:

Unable to build Python 3.6.4 from sources on a fresh Debian system:

@plone /tmp/Python-3.6.4 $ cat /etc/os-release 
PRETTY_NAME="Debian GNU/Linux 9 (stretch)"
NAME="Debian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
ID=debian
HOME_URL="https://www.debian.org/;
SUPPORT_URL="https://www.debian.org/support;
BUG_REPORT_URL="https://bugs.debian.org/;

gcc -pthread -c -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall 
-Wstrict-prototypes-std=c99 -Wextra -Wno-unused-result 
-Wno-unused-parameter -Wno-missing-field-initializers   -I. -I./Include
-DPy_BUILD_CORE \
  -DGITVERSION="\"`LC_ALL=C `\"" \
  -DGITTAG="\"`LC_ALL=C `\"" \
  -DGITBRANCH="\"`LC_ALL=C `\"" \
  -o Modules/getbuildinfo.o ./Modules/getbuildinfo.c
rm -f libpython3.6m.a
ar rc libpython3.6m.a Modules/getbuildinfo.o
ar rc libpython3.6m.a Parser/acceler.o Parser/grammar1.o Parser/listnode.o 
Parser/node.o Parser/parser.o Parser/bitset.o Parser/metagrammar.o 
Parser/firstsets.o Parser/grammar.o Parser/pgen.o Parser/myreadline.o 
Parser/parsetok.o Parser/tokenizer.o
ar rc libpython3.6m.a Objects/abstract.o Objects/accu.o Objects/boolobject.o 
Objects/bytes_methods.o Objects/bytearrayobject.o Objects/bytesobject.o 
Objects/cellobject.o Objects/classobject.o Objects/codeobject.o 
Objects/complexobject.o Objects/descrobject.o Objects/enumobject.o 
Objects/exceptions.o Objects/genobject.o Objects/fileobject.o 
Objects/floatobject.o Objects/frameobject.o Objects/funcobject.o 
Objects/iterobject.o Objects/listobject.o Objects/longobject.o 
Objects/dictobject.o Objects/odictobject.o Objects/memoryobject.o 
Objects/methodobject.o Objects/moduleobject.o Objects/namespaceobject.o 
Objects/object.o Objects/obmalloc.o Objects/capsule.o Objects/rangeobject.o 
Objects/setobject.o Objects/sliceobject.o Objects/structseq.o 
Objects/tupleobject.o Objects/typeobject.o Objects/unicodeobject.o 
Objects/unicodectype.o Objects/weakrefobject.o
ar rc libpython3.6m.a Python/_warnings.o Python/Python-ast.o Python/asdl.o 
Python/ast.o Python/bltinmodule.o Python/ceval.o Python/compile.o 
Python/codecs.o Python/dynamic_annotations.o Python/errors.o 
Python/frozenmain.o Python/future.o Python/getargs.o Python/getcompiler.o 
Python/getcopyright.o Python/getplatform.o Python/getversion.o 
Python/graminit.o Python/import.o Python/importdl.o Python/marshal.o 
Python/modsupport.o Python/mystrtoul.o Python/mysnprintf.o Python/peephole.o 
Python/pyarena.o Python/pyctype.o Python/pyfpe.o Python/pyhash.o 
Python/pylifecycle.o Python/pymath.o Python/pystate.o Python/pythonrun.o 
Python/pytime.o Python/random.o Python/structmember.o Python/symtable.o 
Python/sysmodule.o Python/traceback.o Python/getopt.o Python/pystrcmp.o 
Python/pystrtod.o Python/pystrhex.o Python/dtoa.o Python/formatter_unicode.o 
Python/fileutils.o Python/dynload_shlib.o   Python/thread.o  Python/frozen.o
ar rc libpython3.6m.a Modules/config.o Modules/getpath.o Modules/main.o 
Modules/gcmodule.o
ar rc libpython3.6m.a Modules/_threadmodule.o  Modules/posixmodule.o  
Modules/errnomodule.o  Modules/pwdmodule.o  Modules/_sre.o  
Modules/_codecsmodule.o  Modules/_weakref.o  Modules/_functoolsmodule.o  
Modules/_operator.o  Modules/_collectionsmodule.o  Modules/itertoolsmodule.o  
Modules/atexitmodule.o  Modules/signalmodule.o  Modules/_stat.o  
Modules/timemodule.o  Modules/_localemodule.o  Modules/_iomodule.o 
Modules/iobase.o Modules/fileio.o Modules/bytesio.o Modules/bufferedio.o 
Modules/textio.o Modules/stringio.o  Modules/zipimport.o  
Modules/faulthandler.o  Modules/_tracemalloc.o Modules/hashtable.o  
Modules/symtablemodule.o  Modules/xxsubtype.o
ranlib libpython3.6m.a
gcc -pthread   -Xlinker -export-dynamic -o python Programs/python.o 
libpython3.6m.a -lpthread -ldl  -lutil   -lm  
gcc -pthread   -Xlinker -export-dynamic -o Programs/_testembed 
Programs/_testembed.o libpython3.6m.a -lpthread -ldl  -lutil   -lm  
./python -E -S -m sysconfig --generate-posix-vars ;\
if test $? -ne 0 ; then \
echo "generate-posix-vars failed" ; \
rm -f ./pybuilddir.txt ; \
exit 1 ; \
fi
Could not find platform independent libraries 
Could not find platform dependent libraries 
Consider setting $PYTHONHOME to [:]
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ModuleNotFoundError: No module named 'encodings'

Current thread 0x7f1757349440 (most recent call first):
Aborted
generate-posix-vars failed
Makefile:575: recipe for target 'pybuilddir.txt' failed
make: *** [pybuilddir.txt] Error 1

--
messages: 314442
nosy: ajung
priority: normal
severity: normal
status: open
title: Fatal Python error: Py_Initialize: Unable to get the locale encoding
type: compile error
versio

[issue33070] Add platform triplet for RISC-V

2018-03-13 Thread Andreas Schwab

Change by Andreas Schwab <sch...@linux-m68k.org>:


--
components: Build
nosy: schwab
priority: normal
severity: normal
status: open
title: Add platform triplet for RISC-V
type: enhancement

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33070>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33059] netrc module validates file mode only for /home/user/.netrc

2018-03-12 Thread Andreas Költringer

New submission from Andreas Költringer <andreas.koeltrin...@n-fuse.co>:

On my first try to use the netrc module I got back the error: 

"~/.netrc access too permissive: access permissions must restrict access to 
only the owner"

I changed the file permissions and wrapped this up in try-except and went on to 
write some unit tests (using tempfile), assuming that the file mode checks 
would be performed on any netrc file I passed into the constructor (yes, I did 
not read the documentation sufficiently well).

Anyway, I believe that these security checks should be done for any netrc file 
(they contain sensitive information no matter where they are located on the 
file system). There was already a discussion on the topic

https://bugs.python.org/issue14984

where there was concern regarding backwards-compatibility and the idea to 
re-visit this issue "in the future". That was in 2013, so maybe this "future" 
is now?

--
components: Library (Lib)
messages: 313701
nosy: akoeltringer
priority: normal
severity: normal
status: open
title: netrc module validates file mode only for /home/user/.netrc
type: security
versions: Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33059>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31900] localeconv() should decode numeric fields from LC_NUMERIC encoding, not from LC_CTYPE encoding

2018-01-28 Thread Andreas Schwab

Andreas Schwab <sch...@linux-m68k.org> added the comment:

> The technical issue here is that the libc has no "stateless" function to 
> process bytes and text with one specific locale.

That's not true.  There is a rich set of *_l functions that take a locale_t 
object and operate on that locale.

--
nosy: +schwab

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue31900>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19891] Exiting Python REPL prompt with user without home directory throws error in atexit._run_exitfuncs

2017-10-28 Thread Andreas Krüger

Andreas Krüger <pkydtb...@famsik.de> added the comment:

I can easily reproduce the problem with Docker,
and it does seem to be a permission problem:

$ docker run -ti --rm --user=":" python:3.6.3-jessie bash -c 
"python3"
Python 3.6.3 (default, Oct 10 2017, 02:29:16) 
[GCC 4.9.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 
Error in atexit._run_exitfuncs:
PermissionError: [Errno 13] Permission denied

$ docker run -ti --rm --user=":" python:3.6.3-jessie bash -c 
"HOME=/tmp python3; ls -lta /tmp"
Python 3.6.3 (default, Oct 10 2017, 02:29:16) 
[GCC 4.9.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 
total 8
drwxrwxrwt  2 root root 4096 Oct 28 14:10 .
drwxr-xr-x 55 root root 4096 Oct 28 14:10 ..
-rw---  1  0 Oct 28 14:10 .python_history

--
nosy: +dj3ei
versions: +Python 3.6

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue19891>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28604] Exception raised by python3.5 when using en_GB locale

2017-09-30 Thread Andreas Schwab

Andreas Schwab <sch...@linux-m68k.org> added the comment:

This causes test_float.py to fail with glibc > 2.26.

ERROR: test_float_with_comma (__main__.GeneralFloatCases)
--
Traceback (most recent call last):
  File "/home/abuild/rpmbuild/BUILD/Python-3.6.2/Lib/test/support/__init__.py", 
line 1590, in inner
return func(*args, **kwds)
  File "Lib/test/test_float.py", line 150, in test_float_with_comma
if not locale.localeconv()['decimal_point'] == ',':
  File "/home/abuild/rpmbuild/BUILD/Python-3.6.2/Lib/locale.py", line 110, in 
localeconv
d = _localeconv()
UnicodeDecodeError: 'locale' codec can't decode byte 0xa0 in position 0: 
Invalid or incomplete multibyte or wide character

--

--
nosy: +schwab

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue28604>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31316] Frequent *** stack smashing detected *** with Python 3.6.2/meinheld WSGI server

2017-08-31 Thread Andreas Jung

New submission from Andreas Jung:

We are currently testing Python 3.6.2 with a BottlePY based with "meinheld" 
WSGI server and we see frequently these crashesis this related to Python or 
meinheld in particular?

Linux unknown-device 4.7.0-1-amd64 #1 SMP Debian 4.7.2-1 (2016-08-28) x86_64 
GNU/Linux


2017-08-31 17:40:55,434] WARNING JWK verification disabled
[2017-08-31 17:40:55,435] INFO pimservice version 0.2.0.dev0
[2017-08-31 17:40:55,435] INFO Importing data from 
/home/nils/src/festool/coa-pim-service/SCPortal_de-DE_20170418.xml.zip
[2017-08-31 17:40:55,435] INFO Locales in ZIP file: de-DE
Loading SCPortal_de-DE_20170418.xml (1/1) … done.
Bottle v0.12.12 server starting up (using MeinheldServer())...
Listening on http://localhost:8080/
Hit Ctrl-C to quit.

"0.0.0.0 - - [31/Aug/2017:17:41:27 +] "GET /Search/de-DE HTTP/1.1" 200 
105256 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like 
Gecko) Chrome/59.0.3071.86 Safari/537.36"
*** stack smashing detected ***: 
/home/nils/src/festool/coa-pim-service/bin/python terminated
=== Backtrace: =
/lib/x86_64-linux-gnu/libc.so.6(+0x70bcb)[0x7fdcddbabbcb]
/lib/x86_64-linux-gnu/libc.so.6(__fortify_fail+0x37)[0x7fdcddc34227]
/lib/x86_64-linux-gnu/libc.so.6(__fortify_fail+0x0)[0x7fdcddc341f0]
/home/nils/src/festool/coa-pim-service/lib/python3.6/site-packages/meinheld-0.6.1-py3.6-linux-x86_64.egg/meinheld/server.cpython-36m-x86_64-linux-gnu.so(+0xebdf)[0x7fdcd49c8bdf]
/home/nils/src/festool/coa-pim-service/lib/python3.6/site-packages/meinheld-0.6.1-py3.6-linux-x86_64.egg/meinheld/server.cpython-36m-x86_64-linux-gnu.so(picoev_poll_once_internal+0x95)[0x7fdcd49ce1c5]
/home/nils/src/festool/coa-pim-service/lib/python3.6/site-packages/meinheld-0.6.1-py3.6-linux-x86_64.egg/meinheld/server.cpython-36m-x86_64-linux-gnu.so(+0xfc87)[0x7fdcd49c9c87]
/home/nils/src/festool/coa-pim-service/bin/python(_PyCFunction_FastCallKeywords+0x1a7)[0x4bdcb7]
/home/nils/src/festool/coa-pim-service/bin/python[0x54d47e]
/home/nils/src/festool/coa-pim-service/bin/python(_PyEval_EvalFrameDefault+0x2e63)[0x5512d3]
/home/nils/src/festool/coa-pim-service/bin/python[0x54c681]
/home/nils/src/festool/coa-pim-service/bin/python[0x54d5f5]
/home/nils/src/festool/coa-pim-service/bin/python(_PyEval_EvalFrameDefault+0x2e63)[0x5512d3]
/home/nils/src/festool/coa-pim-service/bin/python[0x54d0d5]
/home/nils/src/festool/coa-pim-service/bin/python(PyEval_EvalCodeEx+0x2f)[0x54dfaf]
/home/nils/src/festool/coa-pim-service/bin/python[0x488cf6]
/home/nils/src/festool/coa-pim-service/bin/python(PyObject_Call+0x3a)[0x4562fa]
/home/nils/src/festool/coa-pim-service/bin/python(_PyEval_EvalFrameDefault+0x32b6)[0x551726]
/home/nils/src/festool/coa-pim-service/bin/python[0x54d0d5]
/home/nils/src/festool/coa-pim-service/bin/python[0x54d394]
/home/nils/src/festool/coa-pim-service/bin/python(_PyEval_EvalFrameDefault+0x3178)[0x5515e8]
/home/nils/src/festool/coa-pim-service/bin/python[0x54c681]
/home/nils/src/festool/coa-pim-service/bin/python[0x54d5f5]
/home/nils/src/festool/coa-pim-service/bin/python(_PyEval_EvalFrameDefault+0x2e63)[0x5512d3]
/home/nils/src/festool/coa-pim-service/bin/python[0x54d0d5]
/home/nils/src/festool/coa-pim-service/bin/python(PyEval_EvalCode+0x23)[0x54df43]
/home/nils/src/festool/coa-pim-service/bin/python(PyRun_FileExFlags+0x167)[0x42ac17]
/home/nils/src/festool/coa-pim-service/bin/python(PyRun_SimpleFileExFlags+0xeb)[0x42ae4b]
/home/nils/src/festool/coa-pim-service/bin/python(Py_Main+0xd8f)[0x43f12f]
/home/nils/src/festool/coa-pim-service/bin/python(main+0x167)[0x421337]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf1)[0x7fdcddb5b2b1]
/home/nils/src/festool/coa-pim-service/bin/python(_start+0x2a)[0x42140a]
=== Memory map: 
0040-007aa000 r-xp  fe:01 18486295   
/usr/bin/python3.6
009a9000-009aa000 r--p 003a9000 fe:01 18486295   
/usr/bin/python3.6
009aa000-00a45000 rw-p 003aa000 fe:01 18486295   
/usr/bin/python3.6
00a45000-00a77000 rw-p  00:00 0 
00fa-15978000 rw-p  00:00 0  [heap]
7fdcd4533000-7fdcd4673000 rw-p  00:00 0 
7fdcd4673000-7fdcd4679000 r-xp  fe:01 14027603   
/home/nils/src/festool/coa-pim-service/lib/python3.6/site-packages/greenlet-0.4.12-py3.6-linux-x86_64.egg/greenlet.cpython-36m-x86_64-linux-gnu.so
7fdcd4679000-7fdcd4878000 ---p 6000 fe:01 14027603   
/home/nils/src/festool/coa-pim-service/lib/python3.6/site-packages/greenlet-0.4.12-py3.6-linux-x86_64.egg/greenlet.cpython-36m-x86_64-linux-gnu.so
7fdcd4878000-7fdcd4879000 r--p 5000 fe:01 14027603   
/home/nils/src/festool/coa-pim-service/lib/python3.6/site-packages/greenlet-0.4.12-py3.6-linux-x86_64.egg/greenlet.cpython-36m-x86_64-linux-gnu.so
7fdcd4879000-7fdcd487a000 rw-p 6000 fe:01 14027603   
/home/nils/s

Installation Python 3.6.x on Windows using command line installer (without GUI)

2017-07-27 Thread Andreas Jung

I need to installed Python 3.6.x on Windows as part of an automated process 
without user-interaction. Recently Python releases provided MSI files for 
installation using the "msiexec" utility however there are no more MSI release 
files available for Python 3.6.X. Are there any alternatives?

-aj

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


[issue30633] Python 3.6.1 installation issues on OpenSuse 42.1: ModuleNotFoundError: No module named 'encodings'

2017-06-12 Thread Andreas Jung

Andreas Jung added the comment:

--enable-optimizations is not the issue

Seems to be somehow related to the locales.

My env is:

ALSA_CONFIG_PATH=/etc/alsa-pulse.conf
AUDIODRIVER=pulseaudio
AUTOJUMP_ERROR_PATH=/home/ajung/.local/share/autojump/errors.log
COLORTERM=1
CONFIG_SITE=/usr/share/site/x86_64-unknown-linux-gnu
CPU=x86_64
CSHEDIT=emacs
CVS_RSH=ssh
DISPLAY=localhost:10.0
EDITOR=vim
FOP_HOME=/opt/fop-1.0
FROM_HEADER=
G_BROKEN_FILENAMES=1
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-15,CP1252
GPG_TTY=/dev/pts/14
HISTSIZE=1000
HOME=/home/ajung
HOST=blackmoon2
HOSTNAME=blackmoon2
HOSTTYPE=x86_64
INPUTRC=/home/ajung/.inputrc
IRCNAME=Andreas Jung (www.andreas-jung.com)
IRCNICK=YET
IRCSERVER=irc.freenet.de irc.belwue.de
JAVA_BINDIR=/usr/java/latest/bin
JAVA_HOME=/usr/java/latest
JAVA_ROOT=/usr/java/latest
JDK_HOME=/usr/java/latest
JRE_HOME=/usr/lib64/jvm/jre
LANG=en_US.UTF-8
LC_ALL=en_US.UTF-8
LESS_ADVANCED_PREPROCESSOR=no
LESSCLOSE=lessclose.sh %s %s
LESSKEY=/etc/lesskey.bin
LESS=-M -I -R
LESSOPEN=lessopen.sh %s
LIBGL_DEBUG=quiet
LOGNAME=ajung
LS_COLORS=no=00:fi=00:di=01;34:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=41;33;01:ex=00;32:*.cmd=00;32:*.exe=01;32:*.com=01;32:*.bat=01;32:*.btm=01;32:*.dll=01;32:*.tar=00;31:*.tbz=00;31:*.tgz=00;31:*.rpm=00;31:*.deb=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.lzma=00;31:*.zip=00;31:*.zoo=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.tb2=00;31:*.tz2=00;31:*.tbz2=00;31:*.xz=00;31:*.avi=01;35:*.bmp=01;35:*.fli=01;35:*.gif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mng=01;35:*.mov=01;35:*.mpg=01;35:*.pcx=01;35:*.pbm=01;35:*.pgm=01;35:*.png=01;35:*.ppm=01;35:*.tga=01;35:*.tif=01;35:*.xbm=01;35:*.xpm=01;35:*.dl=01;35:*.gl=01;35:*.wmv=01;35:*.aiff=00;32:*.au=00;32:*.mid=00;32:*.mp3=00;32:*.ogg=00;32:*.voc=00;32:*.wav=00;32:
LS_OPTIONS=-N --color=tty -T 0
MACHTYPE=x86_64-suse-linux
MAIL=/var/mail/ajung
MANPATH=/usr/share/man:/opt/local/share/man:/usr/X11R6/man
MINICOM=-c on
MORE=-sl
NNTPSERVER=news
NO_AT_BRIDGE=1
OLDPWD=/home/ajung/src
OSTYPE=linux
PAGER=less
PATH=/home/ajung/.autojump/bin:/usr/java/jdk1.8.0_05/jre/bin:/opt/speedata-publisher/bin:/opt/php-7.1.2/bin:/opt/sphinx/bin:/opt/dita-ot-2.3.1/bin:/opt/ditac-2_6_1/bin:/opt/mongodb/bin:/usr/AHFormatterV64_64:/opt/calibre:/opt/xfc/bin:/opt/PDFreactor/bin:/opt/prince-11:/opt/local/bin:/opt/local/sbin:/usr/bin:/home/ajung/bin:/sbin:/bin:/home/ajung/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games:/opt/bin
PILOTPORT=usb:
PP_SERVER=https://demo:d...@pp-server.zopyx.com/
PROFILEREAD=true
PWD=/home/ajung/src/Python-3.6.1
PYTHONSTARTUP=/etc/pythonstart
QEMU_AUDIO_DRV=pa
QT_SYSTEM_DIR=/usr/share/desktop-data
SDK_HOME=/usr/java/latest
SDL_AUDIODRIVER=pulse
SHELL=/bin/bash
SHLVL=1
SSH_AUTH_SOCK=/tmp/ssh-sejLfLH4gS/agent.25203
SSH_CLIENT=192.168.0.66 50756 22
SSH_CONNECTION=192.168.0.66 50756 192.168.0.51 22
SSH_TTY=/dev/pts/14
TERM=xterm-256color
USER=ajung
_=/usr/bin/env
VDPAU_DRIVER=va_gl
WINDOWMANAGER=/usr/bin/startkde
XAUTHLOCALHOSTNAME=blackmoon2
XDG_CONFIG_DIRS=/etc/xdg
XDG_DATA_DIRS=/usr/local/share:/usr/share
XDG_RUNTIME_DIR=/run/user/1000
XDG_SESSION_ID=99
XFC_DIR=/opt/xfc/bin
XINC_HOME=/home/ajung/src/xinc
XKEYSYMDB=/usr/X11R6/lib/X11/XKeysymDB
XNLSPATH=/usr/share/X11/nls



Also tried to set LC_ALL=C but that does not make a difference.

--

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue30633>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30633] Python 3.6.1 installation issues on OpenSuse 42.1: ModuleNotFoundError: No module named 'encodings'

2017-06-12 Thread Andreas Jung

Andreas Jung added the comment:

Just the standard

./configure --prefix=... --enable-optimizations

dance

--
nosy: +ajung

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue30633>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30633] Python 3.6.1 installation issues on OpenSuse 42.1: ModuleNotFoundError: No module named 'encodings'

2017-06-12 Thread Andreas Jung

New submission from Andreas Jung:

Installing Python 3.6.1 from the sources on OpenSuse 42.1 gives me:

o Python/mystrtoul.o Python/mysnprintf.o Python/peephole.o Python/pyarena.o 
Python/pyctype.o Python/pyfpe.o Python/pyhash.o Python/pylifecycle.o 
Python/pymath.o Python/pystate.o Python/pythonrun.o Python/pytime.o 
Python/random.o Python/structmember.o Python/symtable.o Python/sysmodule.o 
Python/traceback.o Python/getopt.o Python/pystrcmp.o Python/pystrtod.o 
Python/pystrhex.o Python/dtoa.o Python/formatter_unicode.o Python/fileutils.o 
Python/dynload_shlib.o   Python/thread.o  Python/frozen.o
ar rc libpython3.6m.a Modules/config.o Modules/getpath.o Modules/main.o 
Modules/gcmodule.o
ar rc libpython3.6m.a Modules/_threadmodule.o  Modules/posixmodule.o  
Modules/errnomodule.o  Modules/pwdmodule.o  Modules/_sre.o  
Modules/_codecsmodule.o  Modules/_weakref.o  Modules/_functoolsmodule.o  
Modules/_operator.o  Modules/_collectionsmodule.o  Modules/itertoolsmodule.o  
Modules/atexitmodule.o  Modules/signalmodule.o  Modules/_stat.o  
Modules/timemodule.o  Modules/_localemodule.o  Modules/_iomodule.o 
Modules/iobase.o Modules/fileio.o Modules/bytesio.o Modules/bufferedio.o 
Modules/textio.o Modules/stringio.o  Modules/zipimport.o  
Modules/faulthandler.o  Modules/_tracemalloc.o Modules/hashtable.o  
Modules/symtablemodule.o  Modules/xxsubtype.o
ranlib libpython3.6m.a
gcc -pthread  -fprofile-generate  -Xlinker -export-dynamic -o python 
Programs/python.o libpython3.6m.a -lpthread -ldl  -lutil   -lm
gcc -pthread  -fprofile-generate  -Xlinker -export-dynamic -o 
Programs/_testembed Programs/_testembed.o libpython3.6m.a -lpthread -ldl  
-lutil   -lm
./python -E -S -m sysconfig --generate-posix-vars ;\
if test $? -ne 0 ; then \
echo "generate-posix-vars failed" ; \
rm -f ./pybuilddir.txt ; \
exit 1 ; \
fi
Could not find platform independent libraries 
Could not find platform dependent libraries 
Consider setting $PYTHONHOME to [:]
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ModuleNotFoundError: No module named 'encodings'

Current thread 0x7f8a8d4c6680 (most recent call first):
/bin/sh: line 5: 31168 Aborted ./python -E -S -m sysconfig 
--generate-posix-vars
generate-posix-vars failed
Makefile:595: recipe for target 'pybuilddir.txt' failed
make[2]: *** [pybuilddir.txt] Error 1
make[2]: Leaving directory '/data/home/ajung/src/Python-3.6.1'
Makefile:511: recipe for target 'build_all_generate_profile' failed
make[1]: *** [build_all_generate_profile] Error 2
make[1]: Leaving directory '/data/home/ajung/src/Python-3.6.1'
Makefile:492: recipe for target 'profile-opt' failed
make: *** [profile-opt] Error 2

Some search on Google reveals some dependency to PYTHONPATH but this variable 
is not set on my system

--
components: Installation
messages: 295757
nosy: zopyx
priority: normal
severity: normal
status: open
title: Python 3.6.1 installation issues on OpenSuse 42.1: ModuleNotFoundError: 
No module named 'encodings'
versions: Python 3.6

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue30633>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: subprocess problem

2017-02-15 Thread Andreas Paeffgen

On 2017-02-11 02:23:12 +, Cameron Simpson said:


  def your_function(...):
with open('/path/to/your/logfile.txt', 'a') as logfp:
  print("PATH=".os.environ['PATH'], file=logfp)
  p=Popen(...)
  p.communicate(...)
  print("p.returncode=%r" % (p.returncode))

and any other interesting values that occur to you. This is really simple, and
doesn't require a terminal or using the logging module.

You can 'tail -f /path/to/your/logfile.txt' in another terminal to watch stuff
happen as you exercise the program.


Thanks for the great advice.
I found out, that the frozen app does not pass the normal path 
variable. All the tricks with passing the correct environment did not 
work. I just hardcoded the existing standard path. After that it worked.


I think it is a problem with frozen apps in general. Cx_Freeze has 
other problems than Pyinstaller. But all need some workarounds for the 
problems.




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


Re: subprocess problem

2017-02-10 Thread Andreas Paeffgen

Thanks for all the great advice.
I tested all the possibilities. So far no luck. If i start the app from 
a terminal, the solutions work. But not, if i start the app-bundle 
(There is no connection to a terminal)


1. Copied the path to p.subprocess
2. Used the def wich: python function
3. Used shutil

When there is no Terminal, there is no error message / status code message.


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


Re: subprocess problem

2017-02-09 Thread Andreas Paeffgen
I guess which does not return an error code. If it does not find 
anything, the return is just blank. If it finds something, the path is 
returned.


So the change of code did not help, because there is just no error message.
Could there be a $path problem in the subprocess started inside the binary?


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


Re: subprocess problem

2017-02-09 Thread Andreas Paeffgen
Maybe i could use another trick to circumvent the problems in the 
frozen app? The frozen apps can be downloaded here: 
https://sourceforge.net/projects/panconvert/files/Newest/


@Cameron:

1. I use PyQT5 for a creating a gui app. To run the app on other 
systems, where no QT5 and PyQT5 is installed, a bundle is created with 
all relevant libraries, so it will start independently. This app 
bundle, is called a frozen app. Not only the source code, but all it 
dependencies are distributed including python3 itself.


2. In the test-environment pandoc is installed in /usr/local/bin/pandoc 
(Mac) or /bin/pandoc (Linux). Which returns the path correctly, at the 
terminal (shell), in Python and in the Gui-App Panconvert.


3. I am aware of the limitations of which. There is a fallback to 
manually insert the path. So the app will function anyway.  And i want 
to avoid to search the whole filesystem. This takes minutes on my test 
machines, so this is no option.


4. I suppose that something is different from executing the code in the 
frozen state. The app e.g. on Mac is not started from a python shell or 
a comand shell. But even on linux, when started from a shell it does 
not work.


5. I will try the hint with dev.null and the p.check_returncode()



@Wolfgang

1. The function should be executed only, if the path is unknown. If the 
user enters the path manually in the settings and pandoc exists, the 
function should not be executed to save computation time.


2. Only if the manually entered path is not correct or empty the 
function should be executed,  hence 'if not os.path.isfile(path_pandoc)'


3. The function fills in the path automatically if which returns a 
value. This works in the source code



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


subprocess problem

2017-02-08 Thread Andreas Paeffgen
The Problem with the subprocess code is: Using the sourcecode 
functioning as normal.

The frozen app with cx_freeze on every platform just returns an empty result

Here is the code in short:
def get_path_pandoc():




   settings = QSettings('Pandoc', 'PanConvert')

   path_pandoc = settings.value('path_pandoc','')




   if not os.path.isfile(path_pandoc):




   if platform.system() == 'Darwin' or os.name == 'posix':

   args = ['which', 'pandoc']

   p = subprocess.Popen(

   args,

   stdin=subprocess.PIPE,

   stdout=subprocess.PIPE)




   path_pandoc = 
str.rstrip(p.communicate(path_pandoc.encode('utf-8'))[0].decode('utf-8')) 




The whole problematic code can be checked on 
http://github.com/apaeffgen/panconvert

in source/converters/interface_pandoc.py

I debugged it with some QMessage-Boxes. I just know, that the returnd 
result is empty.

I tried some stderr on this code also. But also the error message is empty.

Any hints what could be changed in the code, so it also works in the 
frozen app?


At the moment i use python3.4 to 3.5 depending on the platform (Mac, 
Win, Linux)


P.S. Tried also some code with invoking the bash and afterwords the 
which pandoc code. To know avail also




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


[issue3991] urllib.request.urlopen does not handle non-ASCII characters

2017-01-27 Thread Andreas Åkerlund

Andreas Åkerlund added the comment:

Changed the patch after pointers from vadmium.
And quote_uri is changed to quote_iri as martin.panter thought it was more 
appropriate.

--
Added file: http://bugs.python.org/file46440/issue3991_2017-01-27.diff

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue3991>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23462] All os.exec*e variants crash on Windows

2017-01-26 Thread Andreas Bergmeier

Andreas Bergmeier added the comment:

Just hit that bug. Is this really not yet fixed in any newer version?

--
nosy: +Andreas Bergmeier

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue23462>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7434] general pprint rewrite

2016-12-14 Thread Andreas Stenberg

Changes by Andreas Stenberg <andr...@stenite.com>:


--
nosy: +astenberg

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue7434>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28603] traceback module can't format/print unhashable exceptions

2016-11-07 Thread Andreas Stührk

Andreas Stührk added the comment:

It was reported as bug to a project that uses the traceback module 
(https://github.com/bpython/bpython/issues/651). Parsley 
(https://pypi.python.org/pypi/Parsley) is at least one library that uses 
unhashable exceptions, although I guess it's by accident: it defines __eq__, 
but not __hash__ and that makes the exception unhashable under Python 3.

--

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue28603>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28603] traceback module can't format/print unhashable exceptions

2016-11-03 Thread Andreas Stührk

New submission from Andreas Stührk:

The traceback module tries to handle loops caused by an exception's __cause__ 
or __context__ attributes when printing tracebacks. To do so, it adds already 
seen exceptions to a set. Unfortunately, it doesn't handle unhashable 
exceptions:

>>> class E(Exception): __hash__ = None
...
>>> traceback.print_exception(E, E(), None)
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python3.5/traceback.py", line 100, in print_exception
type(value), value, tb, limit=limit).format(chain=chain):
  File "/usr/lib/python3.5/traceback.py", line 439, in __init__
_seen.add(exc_value)
TypeError: unhashable type: 'E'

CPython's internal exception printing pretty much does the same, except it 
ignores any exception while operating on the seen set (see 
https://hg.python.org/cpython/file/8ee4ed577c03/Python/pythonrun.c#l813 ff).

Attached is a patch that makes the traceback module ignore TypeErrors while 
operating on the seen set. It also adds a (minimal) test.

--
components: Library (Lib)
files: unhashable_exceptions.diff
keywords: patch
messages: 280022
nosy: Trundle
priority: normal
severity: normal
status: open
title: traceback module can't format/print unhashable exceptions
Added file: http://bugs.python.org/file45342/unhashable_exceptions.diff

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue28603>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27923] PEP 467 -- Minor API improvements for binary sequences

2016-10-11 Thread Andreas Gnau

Changes by Andreas Gnau <ron...@rondom.de>:


--
nosy: +Rondom

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue27923>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11429] ctypes is highly eclectic in its raw-memory support

2016-10-11 Thread Andreas Gnau

Changes by Andreas Gnau <ron...@rondom.de>:


--
nosy: +Rondom

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue11429>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27973] urllib.urlretrieve() fails on second ftp transfer

2016-09-13 Thread Andreas Gustasfson

Andreas Gustasfson added the comment:

I am also suffering from this bug, using Python 2.7.12 on NetBSD, and it is 
blocking my efforts to do automated testing of NetBSD/Xen.

I'm attaching a minimal test case (only 3 lines).

--
nosy: +gson
Added file: http://bugs.python.org/file44634/test.py

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue27973>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27817] tkinter string variable misinterpreted as boolean

2016-08-21 Thread Andreas Bolsch

Andreas Bolsch added the comment:

I'm afraid I don't know Tcl nor python good enough to be able to strip this 
down to a reasonably simple test case.

However, I wonder what's going on there:

When the Tcl variable holding the radiobutton's value contains "x", "z", ..., 
value->typePtr always equals NULL in "FromObj" (both 2.7.8 and 2.7.12). But if 
the variable contains "y", "yes" etc., value->typePtr always equals 
app->OldBooleanType (again 2.7.8 and 2.7.12). And tcl8.6 has only one boolean 
type according to tclInt.h???

Now 2.7.8 doesn't handle that OldBooleanType in FromObj in any special way, 
whereas 2.7.12 does.

BTW: Setting Tkinter.wantobjects = 0 cures the problem but that's certainly not 
a sensible approach.

--

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue27817>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27817] String variable misinterpreted as boolean

2016-08-20 Thread Andreas Bolsch

New submission from Andreas Bolsch:

Applies to 2.7.10 and 2.7.12:

Installed LinuxCNC from source at https://github.com/LinuxCNC/linuxcnc :
./configure --with-realtime=uspace --enable-simulator 
--enable-non-distributable=yes --prefix=/usr --libdir=/usr/lib64
make
make install

Configured device as per attached files, that's a simulated XYZ-mill.

Now start application with: 
linuxcnc linuxcnc/configs/my-mill/my-mill.ini

The "Manual Control Widget" has a radio button denoted "X", "Y", "Z" with 
values "x", "y" and "z" to select the active axis. "X" and "Z" work as desired, 
but "Y" does not. Instead:

Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib64/python2.7/lib-tk/Tkinter.py", line 1537, in __call__
return self.func(*args)
  File "/usr/bin/axis", line 2323, in jog_plus
a = "xyzabcuvw".index(a)
ValueError: substring not found

Reason: The Tcl button variable "current_axis" gets "y" assigned to as desired. 
The corresponding python variable "a" however, gets "True". I've tracked that 
down to "FromObj" in "_tkinter.c" where "value->typePtr" equals 
"app->OldBooleanType". 

In 2.7.8 and 2.7.9 the behavior is ok, but in 2.7.10 and 2.7.12 button value 
"y" (and of course "yes", "no" etc.) is transformed into boolean a value ...

This change of behaviour depends only on _tkinter.so, exchanging just *this 
single* file makes the problem (dis-) appear.

--
components: Tkinter
messages: 273224
nosy: Andreas Bolsch
priority: normal
severity: normal
status: open
title: String variable misinterpreted as boolean
type: behavior
versions: Python 2.7

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue27817>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Call for Assistance

2016-08-12 Thread Andreas Röhler



On 12.08.2016 06:48, Lawrence D’Oliveiro wrote:

On Wednesday, August 10, 2016 at 3:42:39 AM UTC+12, Reto Brunner wrote:

What on earth isn't "free" enough about

You are free to:
Share — copy and redistribute the material in any medium or format

No you are not. A court has ruled 

 quite clearly that “non-commercial” means PERSONAL USE ONLY, no redistribution or 
republication.


The court ruled at the special case. The institution in question is paid 
by all germans due to a kind of fea imposed - "Rundfunkbeitrag". 
Everyone owning or renting an object in Germany has to pay to them - 
without regard if they uses that media or not. If you have to pay to 
someone, you would not consider that relation non-commercial.

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


Re: Can math.atan2 return INF?

2016-06-30 Thread Andreas Röhler



On 30.06.2016 11:42, Lawrence D’Oliveiro wrote:

On Thursday, June 30, 2016 at 9:31:29 PM UTC+12, Andreas Röhler wrote:


Science is not about believing, but about models.

The nice thing about science is, it works even if you don’t believe in it.



Thats it!
--
https://mail.python.org/mailman/listinfo/python-list


Re: Can math.atan2 return INF?

2016-06-30 Thread Andreas Röhler



On 30.06.2016 10:24, Steven D'Aprano wrote:

On Thursday 30 June 2016 12:13, Rustom Mody wrote:


The irrational and emotional psychological forces that inspire mathematicians
can make interesting reading, but they have no relevance in deciding who is
write or wrong.


Hmm, so math is not inspired by solving real world problems, for example 
in physics or big-data?




  No numbers are real.


Numbers express relations, which are represented as symbols. So far they 
are real, as math exists, the human mind exists.


We don't have any natural numbers, assume Kronecker made a joke. 
"Natural numbers" is the most misleading term in the field maybe.


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


Re: Can math.atan2 return INF?

2016-06-30 Thread Andreas Röhler



On 30.06.2016 10:24, Steven D'Aprano wrote:

On Thursday 30 June 2016 12:13, Rustom Mody wrote:

[ ... ]
Besides, the whole point of science is to develop objective, rational reasons
to believe things.


Science is not about believing, but about models.
Believing is important to make the career of a scientist maybe, it's for 
people outside.

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


Re: Can math.atan2 return INF?

2016-06-30 Thread Andreas Röhler



On 30.06.2016 03:33, Lawrence D’Oliveiro wrote:


So you see, like it or not, we are drawn to the conclusion that there *was* 
indeed something before our particular Big Bang.


That's linear like the Big Bang theorie. What about assuming something 
beyond our notion of time and space, unknown still?

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


Re: Operator Precedence/Boolean Logic

2016-06-23 Thread Andreas Röhler



On 23.06.2016 14:08, Antoon Pardon wrote:

Op 23-06-16 om 13:45 schreef Chris Angelico:

On Thu, Jun 23, 2016 at 7:23 PM, Antoon Pardon
 wrote:

I don't care. In modern mathematics, zero is usaly defined as the
empty set. The empty set contains nothing, but it isn't nothing
itself. Otherwise the empty set would be the same as the set
containing the empty set, since they both would contain the same,
being nothing.

Zero is *the cardinality of* the empty set. The set containing the
empty set has a cardinality of 1.

In modern set theory where the integers are defined as specific kind
of sets, zero *is* the empty set.



Modes are like waves. If one wave arrives being "modern", lets watch out 
for the next.


There not just one set-theory, math is neither revealed nor received on 
some mount - even if the notion of truth has some theological 
connotations ;)

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


Re: Operator Precedence/Boolean Logic

2016-06-23 Thread Andreas Röhler



On 23.06.2016 11:46, Marko Rauhamaa wrote:


Ridiculous? It was this line of thinking that led Paul Dirac to predict
the existence of antimatter.


Marko


Yeah. Maybe we could construct examples already using antagonistic 
charges of electrons?

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


Re: Operator Precedence/Boolean Logic

2016-06-23 Thread Andreas Röhler



On 23.06.2016 11:17, Steven D'Aprano wrote:

[ ... ]
We can derive arithmetic from set theory.


IMO not, resp. not really. But that would make a another item, pretty 
off-topic from Python.


Should you know a place where to continue, would like to follow up.

Thanks BTW.


  Zero is very special: it is defined
as the empty set:

0: {}

The successor of zero (namely, one) is the set of all empty sets:

1: {{}}

Two is the set of zero and one:

2 = {{}, {{}}}

and so forth.





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


  1   2   3   4   5   6   7   8   9   10   >