[issue20692] Tutorial and FAQ: how to call a method on an int

2021-04-28 Thread Amir


Amir  added the comment:

Hi everyone!

I'm going to work on it. I have a plan to submit my pull request in the 
upcoming weeks. 

Thanks.

--
components:  -Interpreter Core
nosy: +Amir.Rastkhadiv20
versions: +Python 3.9 -Python 3.10

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



[issue38292] tkinter variable classes don't link to widget if matplotlib's set_cmap() function is called before the tkinter GUI is instantiated

2019-09-27 Thread Amir Emami


New submission from Amir Emami :

TkInter variable classes don't link to a widget (tested on Checkbutton and 
Scale) if matplotlib.pyplot.set_cmap() function is called before the 
tkinter.Tk() call which instantiates the root of a TkInter GUI. There is no 
problem if it is called after this, though.

Simple example with checkbox attached below:

### Test program start ##

import matplotlib.pyplot as plt
import tkinter as tk

plt.set_cmap('viridis') # <--- when placed here, breaks the variable
root = tk.Tk()
#plt.set_cmap('viridis') # <--- when placed here, everything is fine

# creation of variable class and widget
var = tk.BooleanVar()
tk.Checkbutton(root, variable=var).pack()

# for printing result
def on_click():
print(var.get())
tk.Button(root, text="Print State to Console", command=on_click).pack()

root.mainloop()

--
components: Tkinter
files: tk and plt conflict.py
messages: 353359
nosy: amiraliemami
priority: normal
severity: normal
status: open
title: tkinter variable classes don't link to widget if matplotlib's set_cmap() 
function is called before the tkinter GUI is instantiated
type: behavior
versions: Python 3.6
Added file: https://bugs.python.org/file48627/tk and plt conflict.py

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



[issue38408] urlparse gives no method to build a url with a port

2019-10-08 Thread Amir Mohamadi


Amir Mohamadi  added the comment:

Hi!
I'm a newbie but I'd like to work on this issue
can I work on it???

--
nosy: +Amir

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



[issue38419] The path of check-c-globals.py on README is wrong

2019-10-09 Thread Amir Mohamadi


Change by Amir Mohamadi :


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

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



[issue38536] Trailing space in formatted currency with international=True and symbol following value

2019-10-20 Thread Amir Mohamadi


Amir Mohamadi  added the comment:

Hi!
I'm a newbie.
Can I work on it with your help???

--
nosy: +Amir

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



[issue41556] hostname verification fails if hostname starts with literal IPv4

2021-08-08 Thread Amir Mohamadi


Amir Mohamadi  added the comment:

Seems to be solved by https://github.com/openssl/openssl/pull/16201.
I guess we can close this issue.

--
nosy: +Amir

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



[issue38979] ContextVar[str] should return ContextVar class, not None

2019-12-07 Thread Amir Mohamadi


Amir Mohamadi  added the comment:

@asvetlov I have a question! Should "contextvar_cls_getitem" function be 
changed? And can you please help me figure out how to change it?

--
nosy: +Amir -DahlitzFlorian, gvanrossum, levkivskyi, yselivanov

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



[issue38979] ContextVar[str] should return ContextVar class, not None

2019-12-07 Thread Amir Mohamadi


Change by Amir Mohamadi :


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

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



[issue39524] Escape sequences in doc string of ast._pad_whitespace

2020-02-03 Thread Amir Mohamadi


Amir Mohamadi  added the comment:

But in both cases the 'Output' will contain '\\':
"Replace all chars except '\\f\\t' in a line with spaces."

--
nosy: +Amir

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



[issue39603] [security] http.client: HTTP Header Injection in the HTTP method

2020-02-11 Thread Amir Mohamadi


Amir Mohamadi  added the comment:

can I work on it?!

--
nosy: +Amir

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



[issue39603] [security] http.client: HTTP Header Injection in the HTTP method

2020-02-11 Thread Amir Mohamadi


Amir Mohamadi  added the comment:

@vstinner sorry to bother you, I have a quick question.

the request(...) method is like this:

def request(self, method, url, body=None, headers={}, *,  
encode_chunked=False):
"""Send a complete request to the server."""  
self._send_request(method, url, body, headers, encode_chunked)

'request' calls '_send_request' method and '_send_request' calls 'putrequest' 
inside itself.

So is it good if I encode 'method' parameter to ASCII inside 'putrequest'??!

--

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



[issue39603] [security] http.client: HTTP Header Injection in the HTTP method

2020-02-12 Thread Amir Mohamadi


Change by Amir Mohamadi :


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

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



[issue39603] [security] http.client: HTTP Header Injection in the HTTP method

2020-02-12 Thread Amir Mohamadi


Change by Amir Mohamadi :


--
pull_requests: +17858
pull_request: https://github.com/python/cpython/pull/18485

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



[issue39966] mock 3.9 bug: Wrapped objects without __bool__ raise exception

2020-03-20 Thread Amir Mohamadi


Amir Mohamadi  added the comment:

I'd like to work on it.
Should I add tests to 'Lib/unittest/test/testmock/testmock.py'??

------
nosy: +Amir

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



[issue39966] mock 3.9 bug: Wrapped objects without __bool__ raise exception

2020-03-21 Thread Amir Mohamadi


Change by Amir Mohamadi :


--
keywords: +patch
pull_requests: +18462
stage: test needed -> patch review
pull_request: https://github.com/python/cpython/pull/19102

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



[issue41004] Hash collisions in IPv4Interface and IPv6Interface

2020-06-18 Thread Amir Mohamadi


Amir Mohamadi  added the comment:

Can I make a PR for this?

--
nosy: +Amir

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



[issue41004] Hash collisions in IPv4Interface and IPv6Interface

2020-06-21 Thread Amir Mohamadi


Amir Mohamadi  added the comment:

No @rvteja92, you don't need open multiple PRs, only make your changes on 
master branch. for more informations read this:
https://devguide.python.org/

And for the CLA sign it will take a while to be updated.

--

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



[issue41395] pickle and pickletools cli interface doesn't close input and output file.

2020-08-02 Thread Amir Mohamadi


Change by Amir Mohamadi :


--
nosy: +Amir
nosy_count: 6.0 -> 7.0
pull_requests: +20845
pull_request: https://github.com/python/cpython/pull/21702

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



[issue41772] Zipfile.testzip considers wrong password as correct

2020-09-11 Thread Amir Mohamadi


Change by Amir Mohamadi :


--
components: Library (Lib)
nosy: Amir
priority: normal
severity: normal
status: open
title: Zipfile.testzip considers wrong password as correct
type: behavior

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



[issue41772] Zipfile.testzip considers wrong password as correct

2020-09-11 Thread Amir Mohamadi


Change by Amir Mohamadi :


Added file: https://bugs.python.org/file49453/encrypted.zip

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



[issue41772] Zipfile.testzip considers wrong password as correct

2020-09-11 Thread Amir Mohamadi


New submission from Amir Mohamadi :

Zipfile.testzip sometimes works perfectly with wrong password. refer to poc.py 
I've a zip file with password '76453' and when I try a wrong password with 
extractall:

myzip.setpassword('10006050')
myzip.extractall()

it raises a Bad CRC-32 exception. but when I try testzip instead of extractall:

myzip.setpassword('10006050')
myzip.testzip()

no exception is raised

--
Added file: https://bugs.python.org/file49452/poc.py

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



[issue42008] Internal Random class calling seed() with incorrect argument

2020-10-12 Thread Amir Mohamadi


Amir Mohamadi  added the comment:

Can I open a PR for it?

--
nosy: +Amir

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



[issue42008] Internal Random class calling seed() with incorrect argument

2020-10-12 Thread Amir Mohamadi


Change by Amir Mohamadi :


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

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



[issue42322] Spectre mitigations in CPython interpreter

2020-11-11 Thread Amir Naseredini


New submission from Amir Naseredini :

I was looking up everywhere and could not find any mitigations for Spectre 
attack by a Python interpreter(CPython)! I don't know if my question is correct 
or how feasible it is, but does anyone know if there are any mitigations for 
different variants of Spectre attacks Specter v1 (Spectre-PHT), v2 
(Spectre-BTB), v4 (Spectre-STL) and v5 (Spectre-RSB) at the interpreter level 
for Python?
Looking forward to hearing from you guys :)

--
components: Interpreter Core
messages: 380748
nosy: sahnaseredini
priority: normal
severity: normal
status: open
title: Spectre mitigations in CPython interpreter
type: security
versions: Python 3.10

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



[issue16879] distutils.command.config uses fragile constant temporary file name

2020-11-12 Thread Amir Mohamadi


Amir Mohamadi  added the comment:

Can I open a PR for it?

--
nosy: +Amir

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



[issue16800] tempfile._get_default_tempdir() leaves files behind when HD is full

2012-12-27 Thread Amir Szekely

New submission from Amir Szekely:

tempfile._get_default_tempdir() tries to find a good temporary directory by 
attempting to create a file and write a string into it for all candidate 
directories. It deletes those files right after closing them. But if writing 
rather than creating them fails, the files get left behind. This can happen, 
for example, when the disk is full on Linux. It will let you create the file 
with open() and even write() to it. But as soon as close() is called, OSError 
is raised with errno 28 (No space left on device) and unlink() is never called.

On our system (Linux 2.6.32, ext3), after filling the disk by mistake, we 
suddenly found dozens of random empty files scattered across the file system. 
The candidate list, where they were all found, even includes the root directory 
so the issue is quite visible.

We noticed this problem on Python 2.4.4, but I have been able to reproduce it 
with today's tip.

A possible solution would be wrapping everything between open() and unlink() in 
a try-finally block. This way, no matter what happens, the file will get 
deleted. I have attached a patch implementing this solution and a new test case 
that reproduces the issue. Verified with `make test && make patchcheck`.

--
components: Extension Modules
files: fix_tempfile_leaving_files_behind.patch
keywords: patch
messages: 178362
nosy: kichik
priority: normal
severity: normal
status: open
title: tempfile._get_default_tempdir() leaves files behind when HD is full
type: resource usage
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 
3.4, Python 3.5
Added file: 
http://bugs.python.org/file28464/fix_tempfile_leaving_files_behind.patch

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



[issue16800] tempfile._get_default_tempdir() leaves files behind when HD is full

2012-12-27 Thread Amir Szekely

Amir Szekely added the comment:

Reproduction details:

[root@meh /]# uname -a
Linux meh 2.6.32-131.17.1.el6-0.0.3.smp.pae.gcc4.1.x86.i686 #1 SMP Tue Dec 20 
02:40:22 PST 2011 i686 GNU/Linux
[root@meh /]# pwd
/
[root@meh /]# dd if=/dev/zero of=/tmp/BIG bs=4M
dd: writing `/tmp/BIG': No space left on device
31+0 records in
30+0 records out
127254528 bytes (127 MB) copied, 3.7028 s, 34.4 MB/s
[root@meh /]# ls
bin  boot  dev  etc  home  initrd  lib  lost+found  media  mnt  opt  proc  root 
 sbin  srv  sys  tmp  usr  var
[root@meh /]# python -c "import tempfile; tempfile.mktemp()"
Traceback (most recent call last):
  File "", line 1, in ?
  File "/usr/lib/python2.4/tempfile.py", line 362, in mktemp
dir = gettempdir()
  File "/usr/lib/python2.4/tempfile.py", line 268, in gettempdir
tempdir = _get_default_tempdir()
  File "/usr/lib/python2.4/tempfile.py", line 214, in _get_default_tempdir
raise IOError, (_errno.ENOENT,
IOError: [Errno 2] No usable temporary directory found in ['/tmp', '/var/tmp', 
'/usr/tmp', '/']
[root@meh /]# ls
bin  boot  dev  etc  home  initrd  lib  lost+found  media  mnt  opt  proc  
-qE-nI  root  sbin  srv  sys  tmp  usr  var
[root@meh /]#

--

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



[issue16800] tempfile._get_default_tempdir() leaves files behind when HD is full

2013-02-05 Thread Amir Szekely

Amir Szekely added the comment:

I've submitted a contribution form by e-mail.

--

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



[issue6607] asctime causing python to crash

2009-07-30 Thread Amir Habibi

New submission from Amir Habibi :

I use:
Python 2.6.2 
(r262:71605, Apr 14 2009, 22:40:02) 
[MSC v.1500 32 bit (Intel)] on win32

import time
asctime((2009, 1, 1, 24, 0, 0, 0, 0, 0))

the 24 is a wrong parameter but it should'n't crash the engine. This may
be the side effect of a more serious problem though. An assertion may
fix it.

--
components: None
messages: 91114
nosy: AmirHabibi
severity: normal
status: open
title: asctime causing python to crash
type: crash
versions: Python 2.6

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



[issue6608] asctime causing python to crash

2009-07-30 Thread Amir Habibi

New submission from Amir Habibi :

I use:
Python 2.6.2 
(r262:71605, Apr 14 2009, 22:40:02) 
[MSC v.1500 32 bit (Intel)] on win32

import time
time.asctime((2009, 1, 1, 24, 0, 0, 0, 0, 0))

the 24 is a wrong parameter but it should'n't crash the engine. This may
be the side effect of a more serious problem though. An assertion may
fix it.

--
components: None
messages: 91115
nosy: AmirHabibi
severity: normal
status: open
title: asctime causing python to crash
type: crash
versions: Python 2.6

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



[issue35562] Issue in sizeof() function

2018-12-22 Thread Amir Aslan Haghrah


New submission from Amir Aslan Haghrah :

If you define a structure which contains an 'c_int' and a 'c_double'  member. 
Then run the sizeof() function for it you get 16 as result as follows:

-
from ctypes import c_int
from ctypes import c_double
from ctypes import sizeof
from ctypes import Structure
from struct import Struct

class issueInSizeof(Structure):
_fields_ = [('KEY', c_int),
('VALUE',   c_double)]

print(sizeof(issueInSizeof))

-
output:
16
-

In continue if you add another 'c_int' to your structure and run sizeof() 
function as follows. It return 16 too.

-
from ctypes import c_int
from ctypes import c_double
from ctypes import sizeof
from ctypes import Structure
from struct import Struct

class issueInSizeof(Structure):
_fields_ = [('Index',   c_int),   
('KEY', c_int),  
('VALUE',   c_double)]

print(sizeof(issueInSizeof))

-
output:
16
-

If python assume the size of 'c_int' 4, then it should return 12 in the first 
run. Also if it assume the size of 'c_int' 8 then it should return 24 in the 
second run.

thanks in advance.

--
components: ctypes
messages: 332355
nosy: Amir Aslan Haghrah
priority: normal
severity: normal
status: open
title: Issue in sizeof() function
type: behavior
versions: Python 3.7

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



[issue35562] Issue in sizeof() function

2018-12-22 Thread Amir Aslan Haghrah


Amir Aslan Haghrah  added the comment:

Thank you for your response.

I noticed this issue while working with 'mmap' and memory sharing.
As you said I check it in 'C++' and I got the same result for my struct as 
Python.
-
I used the 'sizeof' function to calculate my struct size to read it from mapped 
memory and I get wrong output in reading memory because of this aligning 
procedure.

Question: Structs map to memory unaligned but sizeof return the aligned size of 
struct.
How we can calculate the sizeof struct to use it in reading from memory?

--

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