[issue37224] test__xxsubinterpreters fails randomly

2020-01-14 Thread Kyle Stanley


Kyle Stanley  added the comment:

I just made a rather interesting discovery. Instead of specifically focusing my 
efforts on the logic with interp_destroy(), I decided to take a closer look at 
the failing unit test itself. 

The main test within DestroyTests that's failing is the following:

```
def test_still_running(self):
main, = interpreters.list_all()
interp = interpreters.create()
with _running(interp):
with self.assertRaises(RuntimeError):
interpreters.destroy(interp)
self.assertTrue(interpreters.is_running(interp))
```

(Specifically, "self.assertRaises(RuntimeError): interpreters.destroy(interp)" 
is the main point of failure)

In order to be 100% certain that it was an issue occurring from 
interpreters.destroy(), I decided to add in a bit of a "sanity check" to ensure 
the interpreter was actually running in the first place before destroying it (I 
also added some extra debugging info):

```
def test_still_running(self):
main, = interpreters.list_all()
interp = interpreters.create()
with _running(interp):
self.assertTrue(interpreters.is_running(interp),
msg=f"Interp {interp} should be running before destruction.")

with self.assertRaises(RuntimeError,
msg=f"Should not be able to destroy interp {interp} while"
   " it's still running."):
interpreters.destroy(interp)

self.assertTrue(interpreters.is_running(interp))
```

The results were very interesting...

```
OK
0:00:49 load avg: 135.49 [306/1] test__xxsubinterpreters failed
test_all (test.test__xxsubinterpreters.DestroyTests) ... ok
test_already_destroyed (test.test__xxsubinterpreters.DestroyTests) ... ok
test_bad_id (test.test__xxsubinterpreters.DestroyTests) ... ok
test_does_not_exist (test.test__xxsubinterpreters.DestroyTests) ... ok
test_from_current (test.test__xxsubinterpreters.DestroyTests) ... ok
test_from_other_thread (test.test__xxsubinterpreters.DestroyTests) ... ok
test_from_sibling (test.test__xxsubinterpreters.DestroyTests) ... ok
test_main (test.test__xxsubinterpreters.DestroyTests) ... ok
test_one (test.test__xxsubinterpreters.DestroyTests) ... ok
test_still_running (test.test__xxsubinterpreters.DestroyTests) ... FAIL

==
FAIL: test_still_running (test.test__xxsubinterpreters.DestroyTests)
--
Traceback (most recent call last):
  File "/home/aeros/repos/aeros-cpython/Lib/test/test__xxsubinterpreters.py", 
line 763, in test_still_running
self.assertTrue(interpreters.is_running(interp),
AssertionError: False is not true : Interp 12 should be running before 
destruction.

--
```

As can be seen from the results above, the interpreter is not even running in 
the first place before it's destroyed, so of course destroy() won't raise an 
RuntimeError. I think this proves that interpreters.destroy() is _not_ where we 
should be focusing our efforts (at least for now). Instead, we should first 
investigate why it's not even running at this point. I suspect the issue 
_might_ be a race condition within the "_running()" context manager that's 
preventing the interpreter from being ran, but I'll have to do some further 
investigation.

I also ran this ~20 times to be 100% certain, and every single one of those 
times the point of failure was at the new assertion check I added before 
destroy(). 

Notably, a rather difficult and hard to explain side effect occurred from 
adding the new assertion. The average number of tests before failure increased 
by a significant amount. In the above test, it was able to pass 306 iterations 
before failing, and in one of my earlier tests it reached over 1000. 

That never happened before on the 3.8 branch, it would very consistently fail 
in the first set of parallel workers if not very soon after. I can say that 
with a degree certainty as well, since I've ran this set of tests a countless 
number of times while trying to debug the failure. But, I have no explanation 
for this.

Do you have any potential ideas, Eric? Also, do you think it might be worth 
adding in the changes I made to DestroyTests.test_still_running above? It 
doesn't directly address the core failure occurring, but I think it improves 
the test significantly; both in functionality and debugging info. I would be 
glad to open a PR if you think the test changes might be useful, as well as 
make any needed adjustments to them.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 

[issue39327] shutil.rmtree using vagrant synched folder fails

2020-01-14 Thread Peter Liedholm


Peter Liedholm  added the comment:

Problem is also reported in virtualbox
https://www.virtualbox.org/ticket/19004

>From that ticket some more analysis is done;
strace reveals that Python has kept an open fd for the directory being removed.

--

___
Python tracker 

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



Re: How to compare in python an input value with an hashed value in mysql table?

2020-01-14 Thread Chris Angelico
On Wed, Jan 15, 2020 at 5:41 PM Growth Hacking Formation
 wrote:
>
> Thanks for helping. That is what I thought.
> Lets say it is the case and I get the key. We know it uses sha256 and it 
> apply to the ascii code.
> What should be the python code in this scenario?
> I am novice and the hash python module is a bit too complex for me. I read 
> the doc.
>
> Thanks.

Look at the source code for the PHP module. Find the parts you need.
My guess is that every hash-related function they call will have a
direct equivalent in Python.

Welcome to the wonderful world of porting code that you don't truly
comprehend :)

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


Re: How to compare in python an input value with an hashed value in mysql table?

2020-01-14 Thread Growth Hacking Formation
Thanks for helping. That is what I thought.
Lets say it is the case and I get the key. We know it uses sha256 and it apply 
to the ascii code.
What should be the python code in this scenario?
I am novice and the hash python module is a bit too complex for me. I read the 
doc.

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


[issue37224] test__xxsubinterpreters fails randomly

2020-01-14 Thread Kyle Stanley


Kyle Stanley  added the comment:

> I also just realized that I can run 
> "test.test__xxsubinterpreters.DestroyTests" by itself with:

> ./python -m test test__xxsubinterpreters.DestroyTests -j200 -F -v

Oops, the correct syntax is:

./python -m test test__xxsubinterpreters --match DestroyTests -j200 -F -v

--

___
Python tracker 

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



[issue8800] add threading.RWLock

2020-01-14 Thread Éric Larivière

Éric Larivière  added the comment:

Hi,

Sorry to wake up a 10 years old discussion


But I think that you might be interested in the following Python package that I 
created and maintain since few years now:

https://pypi.org/project/readerwriterlock/


1- It implements the three type of reader writer lock:
  - Read Priority
  - Write Priority
  - Fair Priority

2- It matches the interface of python threading.Lock

  More specifically:
def acquire(self, blocking: bool = True, timeout: float = -1) -> bool:
def release(self) -> None:

As you can see it supports the 'blocking' and the 'timeout' parameters) and it 
uses the same methods name

3- It supports context manager (__enter__, __exit__)

4- It is also possible (currently not well documented) to provide a lock 
factory when initializing a new reader writer lock to specify the internal lock 
mechanism to use (by default it uses threading.Lock).

def __init__(self, lock_factory: Callable[[], Lockable] = lambda: 
threading.Lock()) -> None:

This hidden feature allows to offer the possibility to implement your own lock 
mechanism (using port, file on disk, etc, ...) and the reader writer lock will 
internally use it (This open the door for multiprocessing locking)

--
nosy: +elarivie
versions:  -Python 3.4

___
Python tracker 

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



Re: Help

2020-01-14 Thread Igor Korot
Hi,

On Tue, Jan 14, 2020 at 10:46 PM kiran chawan  wrote:
>
> Whenever Iam trying to run this 'New  latest version python software 3.8.4
> python ' but it doesn't show any install option and it say ' modify set up
> ' So tell what to do sir plz help me out.

Please explain why are you trying to install python second time?

Thank you.

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


[issue37224] test__xxsubinterpreters fails randomly

2020-01-14 Thread Kyle Stanley


Kyle Stanley  added the comment:

I also just realized that I can run "test.test__xxsubinterpreters.DestroyTests" 
by itself with:

./python -m test test__xxsubinterpreters.DestroyTests -j200 -F -v

For some reason, I hadn't thought of running that class of tests by itself to 
isolate the failure. Prior to this issue, I didn't have experience in debugging 
a group of intermittent failures occurring across different tests. For most 
bugs I've worked on so far, it was a single, clearly defined point of failure; 
or a behavioral issue that wasn't covered in the regression tests.

But, that's certainly useful to know for future debugging and will help to 
improve my workflow for further investigating this issue. It's a lot more 
effective than adding a bunch of skip test annotations throughout the test file!

--

___
Python tracker 

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



[issue37224] test__xxsubinterpreters fails randomly

2020-01-14 Thread Kyle Stanley


Kyle Stanley  added the comment:

Update: I have a bit of good news and not so great news.

The good news is that I had some time to work on this again, specifically with 
isolating the failure in test__xxsubinterpreters.DestroyTests. Locally, I added 
a few temporary "@unittest.skip()" annotations to the other failing tests in an 
unmodified 3.8 until the only failure that would occur was the following:

==
FAIL: test_still_running (test.test__xxsubinterpreters.DestroyTests)
--
Traceback (most recent call last):
  File "/home/aeros/repos/aeros-cpython/Lib/test/test__xxsubinterpreters.py", 
line 764, in test_still_running
interpreters.destroy(interp)
AssertionError: RuntimeError not raised

--

Once the failure was isolated, I applied my changes on top of that branch with 
the skipped tests to ensure my proposed change resolved the above failure. 
Unfortunately, it still occurred.

It was somewhat disappointing, but I'm certainly glad that I waited to 
thoroughly test the proposed changes before opening a PR. I'll continue working 
on this and see if I can find another fix.

--

___
Python tracker 

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



Help

2020-01-14 Thread kiran chawan
Whenever Iam trying to run this 'New  latest version python software 3.8.4
python ' but it doesn't show any install option and it say ' modify set up
' So tell what to do sir plz help me out.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue25872] multithreading traceback KeyError when modifying file

2020-01-14 Thread Michael Graczyk


Change by Michael Graczyk :


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

___
Python tracker 

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



[issue39207] concurrent.futures.ProcessPoolExecutor does not properly reap jobs and spawns too many workers

2020-01-14 Thread Kyle Stanley


Kyle Stanley  added the comment:

> It would certainly be better to start the worker processes on demand. It  
> probably also requires careful thought about how to detect that more workers 
> are required.

Alright. In that case, I'll do some experimentation when I get the chance and 
see if I can come up with an effective way to spawn the worker processes as 
needed, without incurring a significant performance penalty.  

Note: I have a few other projects and obligations in the meantime, so I'm not 
100% certain when I'll have the time to work on this. If anyone else is 
interested in working on this as well, certainly feel free to do so.

--

___
Python tracker 

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



Re: 1 line demo

2020-01-14 Thread 황병희
> suitable nntp test group available ...

There is one suitable group: gmane.test

Plus somebody already know. Gmane NNTP address changed since 2020-01-06.

news.gmane.org ===> news.gmane.io [*]

Sincerely, NNTP fan Byung-Hee

[*]
https://lars.ingebrigtsen.no/2020/01/06/whatever-happened-to-news-gmane-org/

-- 
^고맙습니다 _地平天成_ 감사합니다_^))//
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue17005] Add a topological sort algorithm

2020-01-14 Thread Tim Peters


Tim Peters  added the comment:

Oh, it's fine!  Kahn's algorithm is what I meant when I wrote the "bog-standard 
implementation" before.

I don't believe I've ever seen a context in real life where topsort speed made 
a lick of real difference, so I expect any linear-time (in the sum of the 
number of nodes and edges) would be fine.  Nevertheless, for recording a node's 
successors ("children" in your code), I've always used a list rather than a 
set.  Lists run faster and require less memory than sets, and - unlike sets - 
in Python inherently preserve insertion order.  Iteration order can become 
visible (e.g., if B, C, and D depend on A, what's "the" topsort order?  it 
depends on the order A's children appear when iterating over them - predictable 
with a list, "it depends" with a set).

Note:  "but we have to guard against redundant edges!" would be a red herring.  
Kahn's algorithm couldn't care less, provided that predecessor counts 
accurately reflect the number of edges (redundant or not) entering a node.

--

___
Python tracker 

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



pretty cool way of posting 2

2020-01-14 Thread me

30 lines  of bash with 1 py3 line.

all u need   for usenet !
   



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


pretty cool way of posting

2020-01-14 Thread me

30 lines of bash with 1 py3 line.

all u need for usenet !
   



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


[issue39335] round Decimal edge case

2020-01-14 Thread Benjamin Peterson


Benjamin Peterson  added the comment:

On Python 2, round just converts the decimal to a float. So, this is a 
consequence of:

>>> float(Decimal('-123.49'))
-123.5

--
nosy: +benjamin.peterson
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue17005] Add a topological sort algorithm

2020-01-14 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Disregarding the API, what do you think about the approach of 
https://github.com/python/cpython/pull/11583 for the implementation? Under my 
benchmarks (check previous comments) it seems to perform very good with regards 
to memory and time.

--

___
Python tracker 

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



[issue17005] Add a topological sort algorithm

2020-01-14 Thread Tim Peters


Tim Peters  added the comment:

I'll add ts.py, which was a work-in-progress that implements a minor variation 
of most everything I typed about.  If nothing else, its _find_cycle is useful 
as a non-recursive linear-time cycle finder (recursion is deadly here because 
recursive depth-first search can easily "blow the stack" on larger graphs).

There's also "if 1:"/"else:" blocks that set up parallel cases, using threads 
or processes, and two ways of managing the parallelism (the one I showed 
before, and a more elaborate one that puts an upper bound on how large the 
queues can grow - which is sometimes "a problem" for multiprocessing.queue).

--
Added file: https://bugs.python.org/file48842/ts.py

___
Python tracker 

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



[issue17005] Add a topological sort algorithm

2020-01-14 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Fair enough, I will read this carefully again and try to sketch a prototype 
soon :)

--

___
Python tracker 

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



[issue17005] Add a topological sort algorithm

2020-01-14 Thread Tim Peters


Tim Peters  added the comment:

> I am slightly confused about what .prepare() should do. Why
> is this step necessary?

To say "I'm done adding edges".  Any call to add() after prepare() should raise 
an exception.  Likewise, e.g., any call to get_ready() before prepare() should 
raise an exception.  In a bog-standard topsort implementation, saving for each 
node a sequence of successors and a count of predecessors, this is also the 
time to collect all the nodes that have no predecessors (the first batch 
returned by get_ready()).

Much the same could be done without prepare() by get_ready() making a special 
case out of the first time it's called.  That's more magical, though.  "I'm 
done adding edges" is utterly non-magical.

> - Why we need the .done() method here? Why not instead make get_ready()
> simply a generator so you can just write
>
>for node in self.get_ready():

The point of done() is to enable maximum exploitation of parallelism.  As 
already sketched, if a user doesn't care about that, fine, a different method 
(like static_order()) can generate all the nodes in _some_ static topsort 
order, with no need for done().

But suppose a user does care about parallelism.  Consider graph

A -> B
A -> C
A -> D
B -> D

Output A B C D is a topsort, but useless unless the user is content to "do" one 
node at a time.

Instead get_ready() first returns [A] (or a tuple, or a generator, or a set ... 
something iterable).  A is handed out to worker processes/threads, but 
get_ready() will return an empty iterable until done(A) is called.  Indeed, if 
"doing" A fails, it's NOT the case that anything else can ever be started.

If/when "doing A" succeeds, then done(A) is called, and the next get_ready() 
returns [B, C].  Those can be done in parallel, but D can't be started until 
done(B) is called.  done(B) may or may not be called before done(C) is called - 
the topsort itself has no way to know in advance, nor _should_ it impose its 
own view of that.  Note that D does not depend on C, so there's no need to wait 
for _both_ in [B, C] to finish.  It's necessary and sufficient that B be marked 
done() for D to be ready to go.

> It seems that the .done() is very tight to use this API as a "task
> scheduler" but maybe I am doing something here in my understanding
> of the API.

done() says nothing about how the user "should" schedule work items, but 
instead allows get_ready() to return all the work items whose predecessors have 
been marked done() (but haven't already been passed out by get_ready()).  
That's the maximum set of nodes that _can_ be worked on at the time.  The 
topsort class itself has no policy about how or when they "should" be worked 
on, get_ready() is just identifying all the possibilities that exist.  Which is 
impossible to know unless the class is also told which nodes it already passed 
out have finished - the purpose of done().

is_active() eventually returns False when all the nodes passed out by 
get_ready() have been marked done(), _and_ there are no more nodes ready to 
pass out.  At that point, there's a cycle in the input relations if and only if 
there's some node get_ready() never passed out.

In my prototype implementation, that's another thing prepare() does:  checks 
for a cycle, and raises CycleError if there is one.  The user can catch & 
ignore that if they like, and continue calling get_ready() and done() until no 
more progress can be made.  I think it's more likely, though, that the user 
would stare at the cycle attached to the CycleError instance, do whatever it 
takes to break the cycle, and start over again.

--

___
Python tracker 

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



[issue17005] Add a topological sort algorithm

2020-01-14 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

> Am I seriously suggesting this for Python?  Sure.  It's fun to advance the 
> practical state of the art :-)


I think this API looks very interesting! I have some questions before start 
implementing it to play a bit with it:

- I am slightly confused about what .prepare() should do. Why is this step 
necessary?

- Why we need the .done() method here? Why not instead make get_ready() simply 
a generator so you can just write

for node in self.get_ready():

It seems that the .done() is very tight to use this API as a "task scheduler" 
but maybe I am doing something here in
my understanding of the API.

--

___
Python tracker 

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



[issue39338] Data lost randomly from dictionary after creating the dictionary

2020-01-14 Thread Tim Peters


Tim Peters  added the comment:

No problem!  If you are trying to swap the values in two variables `x` and `y`, 
in most languages that's spelled:

temp = x
x = y
y = temp

and that works in Python too.  But in Python it's more common to do it with a 
one-liner:

x, y = y, x

--

___
Python tracker 

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



Re: How to compare in python an input value with an hashed value in mysql table?

2020-01-14 Thread Chris Angelico
On Wed, Jan 15, 2020 at 10:54 AM Dennis Lee Bieber
 wrote:
>
> On Tue, 14 Jan 2020 10:02:08 -0800 (PST), Growth Hacking Formation
>  declaimed the following:
>
>
> >
> >Hello @formationgrowthhacking,
> >thank you for your message and for using my plugin.
> >For license key hashing, I implemented the PHP native method hash_hmac(), 
> >using the sha256 algorithm.
> >You can check out the class which is responsible for encryption, decryption, 
> >and hashing here:
> >https://plugins.trac.wordpress.org/browser/license-manager-for-woocommerce/trunk/includes/Crypto.php
> >Let me know if this helped!
> >###
> >
>
> https://www.php.net/manual/en/function.hash-hmac.php
> """
>  key
>
> Shared secret key used for generating the HMAC variant of the message
> digest.
> """
> ... Which implies that one needs to know another key to generate the hash
> of the input data. I suspect the author of your database system will not
> reveal that key (check the source code referenced by the author and see if
> you can find a key for use in the hash function).
>

I had a squiz at the linked-to source code, and it looks like the
corresponding key is stored in a file. Whether that actually
constitutes an improvement in security, I can't say. But to be
compatible, you would have to read the same file.

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


[issue38901] [venv] Add a CLI flag to venv to use the pwd basename as the prompt

2020-01-14 Thread Vinay Sajip


Change by Vinay Sajip :


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

___
Python tracker 

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



[issue39336] Immutable module type can't be used as package in custom loader

2020-01-14 Thread Dino Viehland


Dino Viehland  added the comment:

I think the warning shouldn't be too bad.  It looks like ImportWarnings are 
filtered by default already, and the extra overhead of raising a warning in 
this case probably is nothing compared to the actual work in loading the module.

--

___
Python tracker 

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



[issue39336] Immutable module type can't be used as package in custom loader

2020-01-14 Thread Dino Viehland


Change by Dino Viehland :


--
keywords: +patch
pull_requests: +17406
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/18006

___
Python tracker 

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



[issue39295] usage of bitfields in ctypes structures changed between 3.7.5 and 3.7.6

2020-01-14 Thread Matthew Newville


Matthew Newville  added the comment:

@eryksun Sorry for the imprecision -- I was mixing what we do on Linux and 
Windows. A minimum verifiable example for Linux/MacOS would be

import ctypes
class bitstruct(ctypes.Structure):
_fields_ = [('addr', ctypes.c_long),
('rbit', ctypes.c_uint, 1),
('wbit', ctypes.c_uint, 1)]

def handler(args):
print("handler: ", args.addr, args.rbit, args.wbit)

callback = ctypes.CFUNCTYPE(None, bitstruct)(handler)

This works with 3.7.5 but raises a TypeError with 3.7.6.

For Windows (or, well, 64-bit Windows, the only kind we bother to support), we 
find that we have to wrap the function and use a POINTER to the struct, so what 
we really use is more like

import os, functools
def make_callback(args, func):
""" make callback function"""
@functools.wraps(func)
def wrapped(arg, **kwargs):
if hasattr(arg, 'contents'):
return func(arg.contents, **kwargs)
return func(arg, **kwargs)
if os.name =='nt': # also check for 64-bit
cb = ctypes.CFUNCTYPE(None, ctypes.POINTER(args))(wrapped)
else:
cb = ctypes.CFUNCTYPE(None, bitstruct)(handler)
return cb

   callback = make_callback(bitstruct, handler)


> ...
> This seems rights to me. There is no problem passing a pointer 
> as a function parameter.

The problem here is that code that worked with 3.7.5 raises a TypeError with 
3.7.6.

I don't know that the solution we came up with is actually the best approach.  
I've asked for such guidance a few times now.  I don't know why using a pointer 
would be required for a structure containing a "u_int, 1", but not for other 
structures, but any guidance would be much appreciated.

--

___
Python tracker 

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



[issue39305] Merge nntplib._NNTPBase and nntplib.NNTP

2020-01-14 Thread Dong-hee Na


Dong-hee Na  added the comment:

@lucianamarques

Good news, if you submit the patch.
Please ping me and @vstinner :)

--

___
Python tracker 

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



[issue39338] Data lost randomly from dictionary after creating the dictionary

2020-01-14 Thread Y3Kv Bv


Y3Kv Bv  added the comment:

I'm a newbie at Python, also obviously not thinking hard enough over Python's 
mechanics. Shame on me.

--

___
Python tracker 

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



[issue39338] Data lost randomly from dictionary after creating the dictionary

2020-01-14 Thread Tim Peters


Change by Tim Peters :


--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue39338] Data lost randomly from dictionary after creating the dictionary

2020-01-14 Thread Tim Peters


Tim Peters  added the comment:

What, exactly, in the output shows "the problem"?  When I run it, the `a == b` 
part is always True, while `len(x)` and `len(crazyQuilt2)` are always 30.  The 
other three (len(coordinates), len(x2), len(x3)) are always equal to each 
other, but are monotonically non-increasing across output lines.  For example, 
a typical block of output lines:

(True, 30, 30, 30, 30, 30)
(True, 30, 30, 30, 30, 30)
(True, 30, 30, 30, 30, 30)
(True, 30, 30, 30, 30, 30)
(True, 19, 30, 30, 19, 19)
(True, 19, 30, 30, 19, 19)
(True, 19, 30, 30, 19, 19)
(True, 12, 30, 30, 12, 12)
(True, 12, 30, 30, 12, 12)
(True, 12, 30, 30, 12, 12)

None of that surprises me.  Exactly what about it surprises you?  Or do you get 
different kinds of output (and, if so, exactly what?)?

Here's my guess:  you _intended_ these two lines:

  crazyQuilt2[coordinate2Index] = crazyQuilt2[index]
  crazyQuilt2[index] = crazyQuilt2[coordinate2Index]

to _swap_ the values at indices `index` and `coordinate2Index`.  But they 
don't.  They copy the value originally at `index` into the `coordinate2Index` 
position, and leave the value originally at `index` untouched.

As more copies randomly build up, anything that builds a set or dict out of the 
list naturally gets smaller.

--
nosy: +tim.peters -zach.ware
resolution: not a bug -> 
stage: resolved -> 
status: closed -> open

___
Python tracker 

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



[issue34922] hashlib segmentation fault

2020-01-14 Thread Ned Deily


Ned Deily  added the comment:

Since there has been no further discussion on this since the fixes were pushed 
over a year ago, I am declaring this issue resolved.  Thanks for everyone's 
help!

--
assignee: ned.deily -> 
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



[issue39338] Data lost randomly from dictionary after creating the dictionary

2020-01-14 Thread Zachary Ware


Zachary Ware  added the comment:

I suspect your `useAmp` branch is not doing what you think it's doing: it's 
effectively replacing a random number of entries in your `crazyQuilt2` list 
with a duplicate entry (try `print`ing the list every time around the main loop 
to see what's happening to it).  When you later create a dict using the entries 
of the list as keys there are only so many unique keys, and thus the dict is 
not the same length as the list.

--
nosy: +zach.ware
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue39338] Data lost randomly from dictionary after creating the dictionary

2020-01-14 Thread Y3Kv Bv


New submission from Y3Kv Bv :

Windows 7 x64, Python 3.8.1

I've encountered a very weird issue where after creating a dictionary from a 
list the dictionary ends up being shorter/data is lost from it.
It's absolutely random when it loses, how many and which items are lost.

I've attached the example file with the code that always has a chance to 
trigger the issue for me.

I've managed to figure only this much that when "if useAmp" never triggers, 
data loss will never occur. I've added checkpoints to verify where the loss 
occurs and it's not caused by "if useAmp" block directly, data loss happens 
exactly after the dictionary is created.

--
files: test.py
messages: 360007
nosy: Y3Kv Bv
priority: normal
severity: normal
status: open
title: Data lost randomly from dictionary after creating the dictionary
type: behavior
versions: Python 3.8
Added file: https://bugs.python.org/file48841/test.py

___
Python tracker 

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



[issue39336] Immutable module type can't be used as package in custom loader

2020-01-14 Thread Brett Cannon


Brett Cannon  added the comment:

So I think this is way too marginal a use-case to expand the API to let loaders 
inject themselves into the semantics of it.

I assume going with option 1 but raising an ImportWarning would be too noisy 
for your use-case? If not I'm totally fine with that solution.

--

___
Python tracker 

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



[issue38901] [venv] Add a CLI flag to venv to use the pwd basename as the prompt

2020-01-14 Thread Brett Cannon


Brett Cannon  added the comment:

Can this now be closed, Vinay?

--

___
Python tracker 

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



[issue37751] In codecs, function 'normalizestring' should convert both spaces and hyphens to underscores.

2020-01-14 Thread STINNER Victor


STINNER Victor  added the comment:

I created bpo-39337: codecs.lookup() ignores non-ASCII characters, whereas 
encodings.normalize_encoding() copies them.

--

___
Python tracker 

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



[issue39337] codecs.lookup() ignores non-ASCII characters, whereas encodings.normalize_encoding() copies them

2020-01-14 Thread STINNER Victor

New submission from STINNER Victor :

bpo-37751 changed codecs.lookup() in a subtle way: non-ASCII characters are now 
ignored, whereas they were copied unmodified previously.

I would prefer that codecs.lookup() and encodings.normalize_encoding() behave 
the same. Either always ignore or always copy.

Moreover, it seems like there is no test on how the encoding names are 
normalized in codecs.register(). I recall that using codecs.register() in an 
unit test causes troubles since there is no API to unregister a search 
function. Maybe we should just add a private function for test in _testcapi.

Serhiy Storchaka wrote an example on my PR:
https://github.com/python/cpython/pull/17997/files

> There are other differences. For example, normalize_encoding("КОИ-8") returns 
> "кои_8", but codecs.lookup normalizes it to "8".

> The comment in the sources is also not correct.

--
components: Library (Lib)
messages: 360004
nosy: lemburg, serhiy.storchaka, vstinner
priority: normal
severity: normal
status: open
title: codecs.lookup() ignores non-ASCII characters, whereas 
encodings.normalize_encoding() copies them
versions: Python 3.9

___
Python tracker 

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



[issue39329] smtplib.LMTP needs timeout parameter

2020-01-14 Thread STINNER Victor


STINNER Victor  added the comment:

PR merged, thanks.

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

___
Python tracker 

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



[issue39329] smtplib.LMTP needs timeout parameter

2020-01-14 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 65a5ce247f177c4c52cfd104d9df0c2f3b1c91f0 by Victor Stinner 
(Dong-hee Na) in branch 'master':
bpo-39329: Add timeout parameter for smtplib.LMTP constructor (GH-17998)
https://github.com/python/cpython/commit/65a5ce247f177c4c52cfd104d9df0c2f3b1c91f0


--

___
Python tracker 

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



[issue39336] Immutable module type can't be used as package in custom loader

2020-01-14 Thread Dino Viehland


Change by Dino Viehland :


--
nosy: +brett.cannon

___
Python tracker 

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



[issue39336] Immutable module type can't be used as package in custom loader

2020-01-14 Thread Dino Viehland


New submission from Dino Viehland :

I'm trying to create a custom module type for a custom loader where the 
returned modules are immutable.  But I'm running into an issue where the 
immutable module type can't be used as a module for a package.  That's because 
the import machinery calls setattr to set the module as an attribute on it's 
parent in _boostrap.py

# Set the module as an attribute on its parent.
parent_module = sys.modules[parent]
setattr(parent_module, name.rpartition('.')[2], module)

I'd be okay if for these immutable module types they simply didn't have their 
children packages published on them.

A simple simulation of this is a package which replaces its self with an object 
which doesn't support adding arbitrary attributes:

x/__init__.py:
import sys

class MyMod(object):
__slots__ = ['__builtins__', '__cached__', '__doc__', '__file__', 
'__loader__', '__name__', '__package__', '__path__', '__spec__']
def __init__(self):
for attr in self.__slots__:
setattr(self, attr, globals()[attr])


sys.modules['x'] = MyMod()

x/y.py:
# Empty file

>>> from x import y
Traceback (most recent call last):
  File "", line 1, in 
  File "", line 983, in _find_and_load
  File "", line 971, in _find_and_load_unlocked
AttributeError: 'MyMod' object has no attribute 'y'

There's a few different options I could see on how this could be supported:
1) Simply handle the attribute error and allow things to continue
2) Add ability for the modules loader to perform the set, and fallback to 
setattr if one isn't available.  Such as:
 getattr(parent_module, 'add_child_module', setattr)(parent_module, 
name.rpartition('.')[2], module)
3) Add the ability for the module type to handle the setattr:
 getattr(type(parent_module), 'add_child_module', 
fallback)(parent_module, 
, name.rpartition('.')[2], module)

--
assignee: dino.viehland
components: Interpreter Core
messages: 36
nosy: dino.viehland
priority: normal
severity: normal
stage: needs patch
status: open
title: Immutable module type can't be used as package in custom loader
type: behavior

___
Python tracker 

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



Re: 1 line demo

2020-01-14 Thread songbird
Sam Olyk wrote:

...

  while all of this is interesting to a point please
use a suitable nntp test group available instead of 
spamming this group.

  optimally the best would be to set up your own
local server and then test using that.

  thanks


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


[issue39335] round Decimal edge case

2020-01-14 Thread Hrvoje Abraham


New submission from Hrvoje Abraham :

>>> from decimal import Decimal
>>> round(Decimal('-123.49'))
-124.0

I would expect -123.0, even considering Py2 rounding convention details (away 
from zero), Decimal rounding convention (default rounding=ROUND_HALF_EVEN), 
floating point specifics...

Works as expected in Py3. Both Py2 and Py3 use same default Decimal 
rounding=ROUND_HALF_EVEN.

Could be I'm missing some detail...

--
components: Library (Lib)
messages: 35
nosy: ahrvoje
priority: normal
severity: normal
status: open
title: round Decimal edge case
versions: Python 2.7

___
Python tracker 

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



[issue39295] usage of bitfields in ctypes structures changed between 3.7.5 and 3.7.6

2020-01-14 Thread Eryk Sun


Eryk Sun  added the comment:

> With Python 3.7.6 this raises an exception at the ctypes.CFUNCTYPE() 
> call with
> ...
> TypeError: item 1 in _argtypes_ passes a struct/union with a bitfield
> by value, which is unsupported.

I cannot reproduce the problem as stated in 3.7.6 in Windows. The TypeError 
only occurs if I use the struct type directly in argtypes, not a pointer to the 
struct type. For example:

>>> class A(ctypes.Structure):
... _fields_ = (('x', ctypes.c_uint, 1),)

>>> class P_A(ctypes._Pointer):
... _type_ = A
...

allowed:

>>> class FP_P_A(ctypes._CFuncPtr):
... _flags_ = ctypes._FUNCFLAG_CDECL
... _argtypes_ = (P_A,)

disallowed:

>>> class FP_A(ctypes._CFuncPtr):
... _flags_ = ctypes._FUNCFLAG_CDECL
... _argtypes_ = (A,)
...
Traceback (most recent call last):
  File "", line 1, in 
TypeError: item 1 in _argtypes_ passes a struct/union with a bitfield by 
value, which is unsupported.

This seems rights to me. There is no problem passing a pointer as a function 
parameter.

--
nosy: +eryksun

___
Python tracker 

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



[issue39333] argparse should offer an alternative to SystemExit in case a parse fails

2020-01-14 Thread Jack Orenstein


Jack Orenstein  added the comment:

Yes! I didn't know about that method, thank you.

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

___
Python tracker 

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



[issue39334] python specific index directives in our doc has been deprecated 10 years ago

2020-01-14 Thread Julien Palard


Change by Julien Palard :


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

___
Python tracker 

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



[issue39334] python specific index directives in our doc has been deprecated 10 years ago

2020-01-14 Thread Julien Palard


New submission from Julien Palard :

see: https://github.com/sphinx-doc/sphinx/pull/6970

--
assignee: mdk
components: Documentation
messages: 359996
nosy: mdk
priority: normal
severity: normal
status: open
title: python specific index directives in our doc has been deprecated 10 years 
ago

___
Python tracker 

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



[issue39333] argparse should offer an alternative to SystemExit in case a parse fails

2020-01-14 Thread Eric V. Smith


Eric V. Smith  added the comment:

Maybe argparse could raise an exception derived from SystemExit, then you could 
catch that.

--
nosy: +eric.smith

___
Python tracker 

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



[issue39333] argparse should offer an alternative to SystemExit in case a parse fails

2020-01-14 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Does overriding exit help here?

https://docs.python.org/3.8/library/argparse.html#argparse.ArgumentParser.exit

--
nosy: +paul.j3, xtreak

___
Python tracker 

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



[issue38901] [venv] Add a CLI flag to venv to use the pwd basename as the prompt

2020-01-14 Thread Vinay Sajip


Vinay Sajip  added the comment:


New changeset 7d6378051feeadf45b4ce45b4b406b65df255648 by Vinay Sajip in branch 
'master':
bpo-38901: Allow setting a venv's prompt to the basename of the current 
directory. (GH-17946)
https://github.com/python/cpython/commit/7d6378051feeadf45b4ce45b4b406b65df255648


--

___
Python tracker 

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



[issue39333] argparse should offer an alternative to SystemExit in case a parse fails

2020-01-14 Thread Zachary Ware


Change by Zachary Ware :


--
nosy: +rhettinger

___
Python tracker 

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



[issue38921] Max Recursion Depth Reached in Logging Library

2020-01-14 Thread Joy


Joy  added the comment:

This script should produce the following error:

Traceback (most recent call last):
  File "logging_test_script.py", line 70, in 
testobj.main()
  File "logging_test_script.py", line 62, in main
Logger.main_logger.info('Adding a line into {}'.format(source))
  File "/usr/lib/python3.7/logging/__init__.py", line 1378, in info
self._log(INFO, msg, args, **kwargs)
  File "/usr/lib/python3.7/logging/__init__.py", line 1514, in _log
self.handle(record)
  File "/usr/lib/python3.7/logging/__init__.py", line 1524, in handle
self.callHandlers(record)
  File "/usr/lib/python3.7/logging/__init__.py", line 1586, in callHandlers
hdlr.handle(record)
  File "/usr/lib/python3.7/logging/__init__.py", line 894, in handle
self.emit(record)
  File "/usr/lib/python3.7/logging/__init__.py", line 1127, in emit
StreamHandler.emit(self, record)
  File "/usr/lib/python3.7/logging/__init__.py", line 1025, in emit
msg = self.format(record)
  File "/usr/lib/python3.7/logging/__init__.py", line 869, in format
return fmt.format(record)
  File "/usr/lib/python3.7/logging/__init__.py", line 869, in format
return fmt.format(record)
  File "/usr/lib/python3.7/logging/__init__.py", line 869, in format
return fmt.format(record)
  [Previous line repeated 984 more times]
  File "/usr/lib/python3.7/logging/__init__.py", line 609, in format
if self.usesTime():
  File "/usr/lib/python3.7/logging/__init__.py", line 577, in usesTime
return self._style.usesTime()
  File "/usr/lib/python3.7/logging/__init__.py", line 419, in usesTime
return self._fmt.find(self.asctime_search) >= 0
RecursionError: maximum recursion depth exceeded while calling a Python object

--
Added file: https://bugs.python.org/file48840/logging_test_script.py

___
Python tracker 

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



[issue39333] argparse should offer an alternative to SystemExit in case a parse fails

2020-01-14 Thread Jack Orenstein


New submission from Jack Orenstein :

If parse_args fails, SystemExit is raised, carrying an exit code of 2, and the 
help message is printed. For an embedded usage of argparse, this behavior is 
undesirable.

I am writing an interactive console application, using argparse to parse input. 
When a parse fails, I would like to print an error message and continue, not 
terminate the program. Currently, I need to catch SystemExit to be able to do 
this, which has obvious problems, (e.g., what if something other that argparse 
is causing the exit?)

I'd like to see some way to specify alternative behavior, e.g. raise an 
exception of a given type.

--
components: Library (Lib)
messages: 359991
nosy: geophile
priority: normal
severity: normal
status: open
title: argparse should offer an alternative to SystemExit in case a parse fails
type: enhancement

___
Python tracker 

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



[issue39206] Modulefinder does not consider source file encoding

2020-01-14 Thread Luciana


Luciana  added the comment:

Hi there, can somebody who is a core dev please review my PR? Thanks :)

--

___
Python tracker 

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



[issue39305] Merge nntplib._NNTPBase and nntplib.NNTP

2020-01-14 Thread Luciana


Luciana  added the comment:

Hey, I'm taking a look into this!

--
nosy: +lucianamarques

___
Python tracker 

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



[issue39296] Windows register keys

2020-01-14 Thread Tony

Tony  added the comment:

Hi Steve,

Thank you for this. 
I know about the working of WOW64 and the redirection to the 
(HKEY_LOCAL_MACHINE) ..\Wow6432Node, that is explained on md.docs.
The HKEY_CURRENT_USER redirection is not well explained, and so it appears I’m 
not the only one (Google) who was confused about this behavior.
So, again, many thanks for your explanation!

Tony Kalf.

Van: Steve Dower
Verzonden: maandag 13 januari 2020 19:49
Aan: factoryx.c...@gmail.com
Onderwerp: [issue39296] Windows register keys

Steve Dower  added the comment:

You should read the version number from the Version or SysVersion values, 
rather than from the tag.

Having -32 in the key name is a compatibility requirement. Without it, if you 
installed 32-bit and 64-bit versions for the current user (which is now the 
default), they would overwrite each other.

The Wow6432Node key is due to Windows, not Python. We don't decide the name or 
when it is used, and Windows determined that HKEY_CURRENT_USER is not subject 
to registry redirection. That's why you don't see it there.

Hope that helps clarify what's going on.

--

___
Python tracker 

___

--

___
Python tracker 

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



[issue39332] Python 3.6 compiler protections from Ubuntu distros

2020-01-14 Thread Benjamin Peterson


Benjamin Peterson  added the comment:

You should take it up on the Ubuntu issue tracker.

--
nosy: +benjamin.peterson
resolution:  -> third party
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue39332] Python 3.6 compiler protections from Ubuntu distros

2020-01-14 Thread Jason Culligan


New submission from Jason Culligan :

The python3.6 binary supplied in Ubuntu distros is not compiled with Position 
Independent Code (PIE) protection enabled.  Python2 does.  Is this not seen as 
a problem?

Example 1:
(checksec)


FILE:   /usr/bin/python2
RELRO:  Full RELRO
STACK CANARY:   Canary found
NX: NX enabled
PIE:PIE enabled <<<
RPATH:  No RPATH
RUNPATH:No RUNPATH
Symbols:No Symbols
FORTIFY:Yes
Fortified:  14
Fortifiable:32


FILE:   /usr/bin/python3.6
RELRO:  Partial RELRO <<< ISSUE >>>
STACK CANARY:   Canary found
NX: NX enabled
PIE:No PIE <<< ISSUE >>>
RPATH:  No RPATH
RUNPATH:No RUNPATH
Symbols:No Symbols
FORTIFY:Yes
Fortified:  18
Fortifiable:42


Example 2:


$ hardening-check /usr/bin/python2
/usr/bin/python2:
 Position Independent Executable: yes
 Stack protected: yes
 Fortify Source functions: yes (some protected functions found)
 Read-only relocations: yes
 Immediate binding: yes

$ hardening-check /usr/bin/python3.6
/usr/bin/python3.6:
 Position Independent Executable: no, normal executable!
 Stack protected: yes
 Fortify Source functions: yes (some protected functions found)
 Read-only relocations: yes
 Immediate binding: no, not found!

--
components: Build
messages: 359986
nosy: hpawdjit
priority: normal
severity: normal
status: open
title: Python 3.6 compiler protections from Ubuntu distros
type: security
versions: Python 3.6

___
Python tracker 

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



Re: How to compare in python an input value with an hashed value in mysql table?

2020-01-14 Thread Growth Hacking Formation

Thanks for your help.

Litle details,

the license key is goldQ3T8-1QRD-5QBI-9F22

and it is stored in database already encrypted.
License key is not saved in database with clear text. It is already encrypted. 
I am not sure what is this hash column for?

License key =>
def50200962018b6bbed50fc53abca6bb076eb2947fc379e69bd38dcea9f8fbe29eedd43f1148e721d5f6657d8d0152356f5a7ba566dde545a9a354c7b42af88fe4ea7775a4e2ee1a26d8b8f7e3272cf5a8bbe38197fdf19e1726d5e2d769bae408cd511706388abad5a75

hash =>
25138e045e9f50022331340a26d0eecbd0d7ca6bfefee0275749025c4f56c3a8
see screenshot:
http://prntscr.com/qnhz8h

I thought the "hash" column was the key to encrypt or decrypt the license 
stored in column "license_key".


So I run your code for testing with appropriate licese key:
Python Code: 
1
2
3
4
5
6   from hashlib import md5, sha256, sha512
 
key = 'goldQ3T8-1QRD-5QBI-9F22'
 
for hash_func in (md5, sha256, sha512):
print(hash_func(key.encode()).hexdigest())
and it give this outpu:
Output:
ecc58b55c33fe6dfe3b49d6d63aad65b
f67e701240fbd964aa9a0eb81e2f549b8e3dd97e1aa3b1f5796fd12cd9b14005
8288f635fbab6d6511fc5aa63caf153fa434b3d351612cdf48dcf6abea4275cde5f0d6fffda2e7c6fd42350483603cf6959dd62c946eea2b75eca9f60a5cf5b7

Process finished with exit code 0
As you can see, here the code doesn't give same result than database.

===

Regarding wordpress login, I didn't find any python library which can can 
handle this authentification process.

I contacted the developper, and he replied me this message:



Hello @formationgrowthhacking,
thank you for your message and for using my plugin.
For license key hashing, I implemented the PHP native method hash_hmac(), using 
the sha256 algorithm.
You can check out the class which is responsible for encryption, decryption, 
and hashing here:
https://plugins.trac.wordpress.org/browser/license-manager-for-woocommerce/trunk/includes/Crypto.php
Let me know if this helped!
###

But he may not know python. I need help of python expert.

Does this update help for better understanding my issue?

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


[issue39312] Expose placeholder reparse points in Windows

2020-01-14 Thread Eryk Sun


Eryk Sun  added the comment:

Okay, a well-known third-party library will work if a script/application really 
needs this information. I just wanted to bring it up for consideration because 
I saw an issue for cross-platform PowerShell 6 [1] where it was decided to 
disable placeholder disguising, but that particular decision was motivated by 
the need to remain compatible with Windows PowerShell 5.

[1] https://github.com/PowerShell/PowerShell/pull/8745

> Recalling our debates about symlinks, I'd have to say that nothing 
> about placeholder files qualifies them as links, regardless of 
> whether Powershell puts "l" in the attributes summary :)

Certainly. A link (broadly speaking, including Unix-style symlinks and mount 
points) has to be a name surrogate. These OneDrive reparse points do not have 
the [N]ame surrogate bit set. It's not even allowed to be set because they have 
the [D]irectory bit set, which allows the directory entry in the filesystem to 
contain files. This is explained in km\ntifs.h:


// The reparse tags are a ULONG. The 32 bits are laid out as follows:
//
//   3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
//   1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
//  +-+-+-+-+---+---+
//  |M|R|N|D| Reserved bits |   Reparse Tag Value   |
//  +-+-+-+-+---+---+
//
// M is the Microsoft bit. When set to 1, it denotes a tag owned by 
Microsoft.
//   All ISVs must use a tag with a 0 in this position.
//   Note: If a Microsoft tag is used by non-Microsoft software, the
//   behavior is not defined.
//
// R is reserved.  Must be zero for non-Microsoft tags.
//
// N is name surrogate. When set to 1, the file represents another named
//   entity in the system.
//
// D is the directory bit. When set to 1, indicates that any directory
//   with this reparse tag can have children. Has no special meaning when 
used
//   on a non-directory file. Not compatible with the name surrogate bit.

--

___
Python tracker 

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



[issue38361] syslog: Default "ident" in syslog.openlog() shouldn't contain slash

2020-01-14 Thread miss-islington

miss-islington  added the comment:


New changeset f04750bb7af45cb6efab8d92d1ff063f0bf2833d by Miss Islington (bot) 
(Václav Bartoš) in branch 'master':
bpo-38361: syslog: fixed making default "ident" from sys.argv[0] (GH-16557)
https://github.com/python/cpython/commit/f04750bb7af45cb6efab8d92d1ff063f0bf2833d


--
nosy: +miss-islington

___
Python tracker 

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



Re: How to compare in python an input value with an hashed value in mysql table?

2020-01-14 Thread dieter
ad...@formationgrowthhacking.com writes:
> I have a wordpress 5.3 websites which sell a software with license key.
>
> The license key is encrypted and stored in Mysql table. there are 2 columns 
> "license" and "hash":
>
> license_key   
> def50200352f5dc4bd8181a9daebbf4f9177fe725111a5a479d64636d01c2a10074e0c645abe898dea18210af563a5334288420551ab61c18ca4506cd03aa5d2bdd40933ddf7ca4d4b61b1c0f58a3830cbe0891cf4ff526311d5d637a55a574eca2c3a1b487b56
>
> hash
> 9498cbf8bf00d6c55e31f98ba6d8294afa3127a84f31aa622c4158ac7377c6dd
>
>
> My python program get an input for user (the license key in string without 
> any encrypton) and need to compare it with the official license key stored in 
> Mysql database of our Wordpress website.
>
> I read a lot of hashlib python, functions and methods. But I didn't find 
> anywhere how could I "hash" the string input typed by user with some hash 
> values from the table, in order to compare both values (the input license and 
> the license stored in mysql table).

Contact the person responsible for the data in your database.
Ask him which hashing algorithm should be used to verify the
license info provided by a user against the database info.

Note: there are many different hashing functions (e.g. "md5", "sha1",
"sha256", ...) and often their use involves an additionl secret
(besides the hashed data). Best get those details from a
knowledgable person than from us.

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


Re: Problem using pip

2020-01-14 Thread proplayer raj
Yes, that's it. Thanks for your help

On Tue, Jan 14, 2020, 7:47 PM Jerry Hill  wrote:

> On Tue, Jan 14, 2020 at 2:18 AM proplayer raj
>  wrote:
> >
> > dear team
> > I have encountered a problem while using pip , that it did not allowed to
> > install webbrowsing and OS module it show the error that it does not
> found
> > any matching distributor and does not fount the version which can fulfill
> > the requirement.
>
> Can you be specific about which modules you are trying to install?  I
> don't see any sign of a python package called 'webbrowsing' anywhere
> on the internet, for instance.  Are you possibly looking for the
> 'webbrowser' module?  If so, it's not installed via pip, it's part of
> the python standard library (see docs here:
> https://docs.python.org/3/library/webbrowser.html).  There's also an
> 'os' module in the standard library
> (https://docs.python.org/3/library/os.html). Are those the modules you
> were looking for?
>
> --
> Jerry
>
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue39322] Add gc.is_finalized to check if an object has been finalised by the gc

2020-01-14 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset b6791375b2ff86ea07f068fb53d9575c337eaa5b by Pablo Galindo in 
branch 'master':
bpo-39322: Add gc.is_finalized to the gc module docstring (GH-18000)
https://github.com/python/cpython/commit/b6791375b2ff86ea07f068fb53d9575c337eaa5b


--

___
Python tracker 

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



[issue39322] Add gc.is_finalized to check if an object has been finalised by the gc

2020-01-14 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
pull_requests: +17404
pull_request: https://github.com/python/cpython/pull/18000

___
Python tracker 

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



[issue39312] Expose placeholder reparse points in Windows

2020-01-14 Thread Steve Dower


Steve Dower  added the comment:

Given the minimum version requirement, I'd rather this support go into a 
third-party library. (Seems like a great candidate for a context manager, too.)

Recalling our debates about symlinks, I'd have to say that nothing about 
placeholder files qualifies them as links, regardless of whether Powershell 
puts "l" in the attributes summary :)

The ecosystem could really do with a Windows-aware filesystem library for this 
kind of support (and I might already be working on one occasionally, pitching 
it as a MSFT-supported package, which is why it's not public yet).

I'd rather keep the standard library as lowest common denominator for system 
interactions, particularly for behaviour like this that is either 
automatic+surprising or manual+platform-specific and insufficiently compelling 
(os.add_dll_directory being an example of something that was sufficiently 
compelling).

So I'm going to mark this as rejected, and steal the idea for my own library :D

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

___
Python tracker 

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



[issue39318] NamedTemporaryFile could cause double-close on an fd if _TemporaryFileWrapper throws

2020-01-14 Thread Eryk Sun


Eryk Sun  added the comment:

> I afraid that removing a file while the file descriptor is open 
> may not work on Windows. Seems this case is not well tested.

os.remove will succeed on a file that's opened with O_TEMPORARY, which shares 
delete access (i.e. FILE_SHARE_DELETE).

With classic Windows delete semantics, deleting a file sets the delete 
disposition on the filesystem's underlying file/link control block (FCB/LCB). 
The filesystem doesn't unlink the file from the directory until all File object 
references have been finalized. (A File handle refers to a kernel File object, 
which refers to an FCB/LCB in a filesystem. An FCB/LCB can be referenced by 
multiple File objects, such as from multiple CreateFileW calls, and a File 
object can be referenced by multiple handles, such as via inheritance or 
DuplicateHandle.) The deleted file remains accessible to existing File objects, 
and a File object with delete access can even be used to clear the delete 
disposition (i.e. undelete the file) via SetFileInformationByHandle: 
FileDispositionInfo. The file remains linked and visible in the parent 
directory, but no new access is allowed while its delete disposition is set. 
The parent directory cannot itself be deleted until the file is unlinked.

In Windows 10 1903, DeleteFileW has also been updated to use POSIX semantics if 
the filesystem supports it, which includes NTFS on the system drive, where temp 
files are usually created. With POSIX semantics, the file is unlinked as soon 
as DeleteFileW closes its File handle. All existing File objects can continue 
to access the file even though it's no longer linked in the directory. This 
includes being able to call GetFinalPathNameByHandleW, which, at least for 
NTFS, will show that the file has been moved to the special system directory 
"\$Extend\$Deleted" and renamed according to its file ID. As is usual for a 
deleted file, no new access is allowed, i.e. we cannot reopen a file in the 
"$Deleted" directory. Another change with POSIX semantics is that the delete is 
final. Existing File objects that have delete access are not allowed to clear 
the delete disposition (i.e. undelete the file).

--
nosy: +eryksun

___
Python tracker 

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



[issue39330] Way to build without IDLE

2020-01-14 Thread Reece Dunham


Reece Dunham  added the comment:

Okay, closing it then. Thanks for the info.

--
stage:  -> resolved
status: pending -> closed

___
Python tracker 

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



[issue39330] Way to build without IDLE

2020-01-14 Thread Zachary Ware


Zachary Ware  added the comment:

I'm not sure what you mean here.  IDLE is a pure-Python application, though it 
does depend on the optional tkinter package.  If you're on a UNIX platform and 
Tcl/Tk headers and libraries can't be found, _tkinter won't be built and you 
won't be able to run IDLE; on Windows if you pass the --no-tkinter (or -E) flag 
to PCbuild/build.bat, _tkinter won't be built and you won't be able to run 
IDLE.  In neither case is it an error to not have _tkinter (unless you try to 
import it).

There is no "building" of IDLE itself, and thus no way to not build it :)

--
nosy: +zach.ware
status: open -> pending

___
Python tracker 

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



[issue39331] 2to3 mishandles indented imports

2020-01-14 Thread Guy Galun


New submission from Guy Galun :

When encountering an import that should be removed in Python 3 (e.g. "from 
itertools import izip"), 2to3 changes it a blank line, which may cause a 
runtime error if that import was indented:

error: module importing failed: expected an indented block (ptypes.py, line 10)
  File "temp.py", line 1, in 
  File "./lldbmacros/xnu.py", line 771, in 
from memory import *
  File "./lldbmacros/memory.py", line 11, in 
import macho
  File "./lldbmacros/macho.py", line 3, in 
from macholib import MachO as macho
  File "./lldbmacros/macholib/MachO.py", line 10, in 
from .mach_o import MH_FILETYPE_SHORTNAMES, LC_DYSYMTAB, LC_SYMTAB
  File "./lldbmacros/macholib/mach_o.py", line 16, in 
from macholib.ptypes import p_uint32, p_uint64, Structure, p_long, 
pypackable

Relevant section before 2to3:

try:
from itertools import izip, imap
except ImportError:
izip, imap = zip, map
from itertools import chain, starmap

And after 2to3:

try:

except ImportError:
izip, imap = zip, map
from itertools import chain, starmap


* Side note:
This specific case may only be problematic with scripts that are partially 
aware of Python 3, otherwise they wouldn't try-catch that import.

* Proposed solution:
In case of that kind of import being the single line of an indented block, 
change it to "pass" instead of a blank line.

--
components: 2to3 (2.x to 3.x conversion tool)
files: ptypes.py
messages: 359978
nosy: galun.guy
priority: normal
severity: normal
status: open
title: 2to3 mishandles indented imports
type: crash
versions: Python 3.9
Added file: https://bugs.python.org/file48839/ptypes.py

___
Python tracker 

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



[issue39330] Way to build without IDLE

2020-01-14 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +taleinat, terry.reedy

___
Python tracker 

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



[issue38530] Offer suggestions on AttributeError

2020-01-14 Thread STINNER Victor


STINNER Victor  added the comment:

Related issue: PEP 534 -- Improved Errors for Missing Standard Library Modules
https://www.python.org/dev/peps/pep-0534/

--

___
Python tracker 

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



[issue39330] Way to build without IDLE

2020-01-14 Thread Reece Dunham


New submission from Reece Dunham :

It would just be better in my opinion if there was a way to build without IDLE, 
for people that are building from source and don't want it.

This doesn't have to be implemented, it is just something I think would make 
the build system a bit better.

--
components: Build
messages: 359976
nosy: rdil
priority: normal
severity: normal
status: open
title: Way to build without IDLE
type: enhancement
versions: Python 3.9

___
Python tracker 

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



Re: Problem using pip

2020-01-14 Thread Jerry Hill
On Tue, Jan 14, 2020 at 2:18 AM proplayer raj
 wrote:
>
> dear team
> I have encountered a problem while using pip , that it did not allowed to
> install webbrowsing and OS module it show the error that it does not found
> any matching distributor and does not fount the version which can fulfill
> the requirement.

Can you be specific about which modules you are trying to install?  I
don't see any sign of a python package called 'webbrowsing' anywhere
on the internet, for instance.  Are you possibly looking for the
'webbrowser' module?  If so, it's not installed via pip, it's part of
the python standard library (see docs here:
https://docs.python.org/3/library/webbrowser.html).  There's also an
'os' module in the standard library
(https://docs.python.org/3/library/os.html). Are those the modules you
were looking for?

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


[issue39329] smtplib.LMTP needs timeout parameter

2020-01-14 Thread Dong-hee Na


Change by Dong-hee Na :


--
pull_requests: +17403
pull_request: https://github.com/python/cpython/pull/17999

___
Python tracker 

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



[issue39329] smtplib.LMTP needs timeout parameter

2020-01-14 Thread Dong-hee Na


Change by Dong-hee Na :


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

___
Python tracker 

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



[issue39329] smtplib.LMTP needs timeout parameter

2020-01-14 Thread Dong-hee Na


New submission from Dong-hee Na :

see: https://github.com/python/cpython/pull/17958#issuecomment-573390867

I've noticed that LMTP does not support the timeout parameter.
See: https://docs.python.org/3.9/library/smtplib.html#smtplib.LMTP

However, LMTP also able to use the socket which is created from SMTP.
IMHO LMTP needs to support the timeout parameter.

--
assignee: corona10
components: Library (Lib)
messages: 359975
nosy: corona10, vstinner
priority: normal
severity: normal
status: open
title: smtplib.LMTP needs timeout parameter
type: enhancement
versions: Python 3.9

___
Python tracker 

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



[issue37751] In codecs, function 'normalizestring' should convert both spaces and hyphens to underscores.

2020-01-14 Thread STINNER Victor


STINNER Victor  added the comment:

> Please note that external codec packages should not rely on the semantics of 
> the Python stdlib encodings package's search function.

latexcodec does register a search function.

> It's good practice to always only use ASCII lower case chars and the 
> underscore for codec names.

latexcodec uses encoding names like "latex+ascii" and their search function 
used "+" as a separator.

Don't worry, I just fixed latexcodec, my fix is already merged upstream! I 
simply changed the search function to split on "_" if the name contains "_".

* 
https://github.com/mcmtroffaes/latexcodec/commit/a30ae2cf061d7369b1aaa8179ddd1b486974fdad
* https://github.com/mcmtroffaes/latexcodec/pull/76
* https://github.com/mcmtroffaes/latexcodec/issues/75

--

___
Python tracker 

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



[issue37751] In codecs, function 'normalizestring' should convert both spaces and hyphens to underscores.

2020-01-14 Thread Marc-Andre Lemburg


Marc-Andre Lemburg  added the comment:

Just to clarify: the change in the C implementation was the breaking change. 
The patch just restores the previous behavior: 
https://github.com/python/cpython/blob/master/Lib/encodings/__init__.py#L43

Please note that external codec packages should not rely on the semantics of 
the Python stdlib encodings package's search function. They should really 
register their own search function: 
https://docs.python.org/3.9/library/codecs.html#codecs.register

It's good practice to always only use ASCII lower case chars and the underscore 
for codec names.

--

___
Python tracker 

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



[issue37751] In codecs, function 'normalizestring' should convert both spaces and hyphens to underscores.

2020-01-14 Thread STINNER Victor


STINNER Victor  added the comment:

It seems quite easy to update latexcodec project to support Python 3.9. I 
proposed a solution there:
https://bugzilla.redhat.com/show_bug.cgi?id=1789613#c6

--

___
Python tracker 

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



[issue37751] In codecs, function 'normalizestring' should convert both spaces and hyphens to underscores.

2020-01-14 Thread STINNER Victor


STINNER Victor  added the comment:

> The change is backwards incompatible and a backport would break things. See 
> for example how it breaks latexcodec:

I reopen the issue. I proposed PR 17997 to *document* the incompatible change 
in What's New in Python 3.8. IMO it's a deliberate change and it's correct.

I rely on Marc-Andre Lemburg who implemented codecs and encodings modules. He 
wrote: "Jordon is right. Conversion has to be to underscores, not hyphens.".

--
resolution: fixed -> 
status: closed -> open

___
Python tracker 

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



[issue37751] In codecs, function 'normalizestring' should convert both spaces and hyphens to underscores.

2020-01-14 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +17401
pull_request: https://github.com/python/cpython/pull/17997

___
Python tracker 

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



[issue37751] In codecs, function 'normalizestring' should convert both spaces and hyphens to underscores.

2020-01-14 Thread Miro Hrončok

Miro Hrončok  added the comment:

The change is backwards incompatible and a backport would break things. See for 
example how it breaks latexcodec:

https://bugzilla.redhat.com/show_bug.cgi?id=1789613#c2

--
nosy: +hroncok

___
Python tracker 

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



Re: How to compare in python an input value with an hashed value in mysql table?

2020-01-14 Thread Pieter van Oostrum
ad...@formationgrowthhacking.com writes:

> I have a wordpress 5.3 websites which sell a software with license key.
>
> The license key is encrypted and stored in Mysql table. there are 2 columns 
> "license" and "hash":
>
> license_key   
> def50200352f5dc4bd8181a9daebbf4f9177fe725111a5a479d64636d01c2a10074e0c645abe898dea18210af563a5334288420551ab61c18ca4506cd03aa5d2bdd40933ddf7ca4d4b61b1c0f58a3830cbe0891cf4ff526311d5d637a55a574eca2c3a1b487b56
>
> hash
> 9498cbf8bf00d6c55e31f98ba6d8294afa3127a84f31aa622c4158ac7377c6dd
>
Slightly off-topic:

Why would you store *both* an encrypted key and a hash?
If you have the encrypted key in the database and the encryption key on your 
site (presumably in the Python code) and your site is hacked, all the license 
keys are potentially in the open.
And if your key is on the site you can as well encrypt the entered license key 
and compare it to the stored encrypted key.

end off-topic

> My python program get an input for user (the license key in string
> without any encrypton) and need to compare it with the official license
> key stored in Mysql database of our Wordpress website.
>
> I read a lot of hashlib python, functions and methods. But I didn't find
> anywhere how could I "hash" the string input typed by user with some
> hash values from the table, in order to compare both values (the input
> license and the license stored in mysql table).

This supposes Python 3:

Let's assume the entered key is in ASCII and stored in the variable 'key'.

from hashlib import sha256
key = bytes(key, 'ascii')
hash = sha256(key).hexdigest()

Now you can compare hash with the stored hash in the database. Of course this 
only works if that stored hash has been calculated in the same way from the 
same key.

On Python 2 (which you shouldn't use) you can leave out the "key = bytes(key, 
'ascii')" part.

You can of course make it more sophisticated, for example by using a salt. 
Unless your keys are extremely valuable, I wouldn't bother with that.
-- 
Pieter van Oostrum
www: http://pieter.vanoostrum.org/
PGP key: [8DAE142BE17999C4]
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue39048] Look up __aenter__ before __aexit__ in the async with statement

2020-01-14 Thread Géry

Change by Géry :


--
title: Look up __aenter__ before __aexit__ in async with -> Look up __aenter__ 
before __aexit__ in the async with statement

___
Python tracker 

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



[issue39037] Look up __enter__ before __exit__ in the with statement documentation

2020-01-14 Thread Géry

Change by Géry :


--
title: Fix the trial order of the __exit__ and __enter__ methods in the with 
statement documentation -> Look up __enter__ before __exit__ in the with 
statement documentation

___
Python tracker 

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



[issue39048] Look up __aenter__ before __aexit__ in async with

2020-01-14 Thread Géry

Change by Géry :


--
title: Change the lookup order of __aenter__ and __aexit__ for async with -> 
Look up __aenter__ before __aexit__ in async with

___
Python tracker 

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



[issue39322] Add gc.is_finalized to check if an object has been finalised by the gc

2020-01-14 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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

___
Python tracker 

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



[issue39259] poplib.POP3/POP3_SSL should reject timeout = 0 (non-blocking mode)

2020-01-14 Thread STINNER Victor


STINNER Victor  added the comment:

Thanks Dong-hee Na for all these nice changes!

--

___
Python tracker 

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



[issue39322] Add gc.is_finalized to check if an object has been finalised by the gc

2020-01-14 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset a2ec3f07f7f028ff6229d6be2a7cfbda1f4efaeb by Pablo Galindo in 
branch 'master':
bpo-39322: Add gc.is_finalized to check if an object has been finalised by the 
gc (GH-17989)
https://github.com/python/cpython/commit/a2ec3f07f7f028ff6229d6be2a7cfbda1f4efaeb


--

___
Python tracker 

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



[issue39259] poplib.POP3/POP3_SSL should reject timeout = 0 (non-blocking mode)

2020-01-14 Thread STINNER Victor


Change by STINNER Victor :


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

___
Python tracker 

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



[issue39048] Change the lookup order of __aenter__ and __aexit__ for async with

2020-01-14 Thread Nick Coghlan


Change by Nick Coghlan :


--
resolution:  -> fixed
stage:  -> resolved
status: open -> closed
type: behavior -> enhancement
versions:  -Python 3.8

___
Python tracker 

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



[issue39048] Change the lookup order of __aenter__ and __aexit__ for async with

2020-01-14 Thread Nick Coghlan

Nick Coghlan  added the comment:


New changeset 1d1b97ae643dd8b22d87785ed7bd2599c6c8dc8d by Nick Coghlan (Géry 
Ogam) in branch 'master':
bpo-39048: Look up __aenter__ before __aexit__ in async with (GH-17609)
https://github.com/python/cpython/commit/1d1b97ae643dd8b22d87785ed7bd2599c6c8dc8d


--
nosy: +ncoghlan

___
Python tracker 

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



[issue39328] Allow filename mismatch in local and central directories in zipfile.py

2020-01-14 Thread Cheryl Sabella


New submission from Cheryl Sabella :

This is being opened from the report on GH3035.

During malware research I bumped int problem with my Python based file 
analyzer: miscreants are modifying ZIP file header parts so, that python based 
automated analysis tools are unable to process the contents but intended 
clients are able to open the files with end-user applications and extract the 
possibly malicious contents. Proposed patch makes it possible to process the 
ZIP files even if such conditions occur. Default behavior remains the same 
(raise BadZipFile exception).

--
messages: 359966
nosy: cheryl.sabella, gregory.p.smith
priority: normal
severity: normal
stage: needs patch
status: open
title: Allow filename mismatch in local and central directories in zipfile.py
type: enhancement
versions: Python 3.9

___
Python tracker 

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



[issue39033] zipimport raises NameError: name '_boostrap_external' is not defined

2020-01-14 Thread Petr Viktorin


Petr Viktorin  added the comment:

Thank you, Mihail and Karthikeyan!

--
nosy: +petr.viktorin
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



[issue39033] zipimport raises NameError: name '_boostrap_external' is not defined

2020-01-14 Thread miss-islington


miss-islington  added the comment:


New changeset 9955f33cdbf27de270038dfbad37d15b160ecca2 by Miss Islington (bot) 
(Karthikeyan Singaravelan) in branch '3.8':
[3.8] bpo-39033: Fix NameError in zipimport during hash validation (GH-17588) 
(GH-17642)
https://github.com/python/cpython/commit/9955f33cdbf27de270038dfbad37d15b160ecca2


--
nosy: +miss-islington

___
Python tracker 

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



Re: self - hosted usenet poster py script - pretty cool, 20 lines only

2020-01-14 Thread 황병희
Chris Angelico  writes:

> On Tue, Jan 14, 2020 at 7:31 PM aa  wrote:
>> X-User-Signature: python spam now comes to comp lang py as well
>>
>
> Can you post to a test newsgroup instead? Please?

By the way, he is trying new experimental thing.
Actually i like his trying and NNTP.

Sincerely, NNTP fan Byung-Hee

-- 
^고맙습니다 _地平天成_ 감사합니다_^))//
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: NNTPlib apps work like a charm

2020-01-14 Thread 황병희
Julie  writes:

> why is anybody using anything else than Py for usenet ?

Only i use Python3 making Message-ID within Gnus.
https://gitlab.com/soyeomul/Gnus/raw/master/thanks-mid.py

Sincerely,

-- 
^고맙습니다 _地平天成_ 감사합니다_^))//
-- 
https://mail.python.org/mailman/listinfo/python-list


  1   2   >