Change by Cong Ma :
--
keywords: +patch
pull_requests: +23787
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/25039
___
Python tracker
<https://bugs.python.org/issu
Cong Ma added the comment:
Some more context: Issue 37646. The demo in that one was "eval inside
list-comprehension-scope", while this one is the other way around.
Perhaps another example may better illustrate the interplay between eval and
the execution environment:
```
def f():
Cong Ma added the comment:
> sum(get(i) for i in range(len(l)))
This expression inside the body of ``func()`` references the name "get" and "l"
(ell), both are local to the scope introduced by ``func()``. More specifically,
these two names are referenced in
Cong Ma added the comment:
I'm preparing an update to the documentation of eval/exec. There are several
issues, but chiefly I'll link to the appropriate sections in the Language
Reference, and clean up some other inaccuracies. When it's ready I'll submit a
PR for core devs to review
Cong Ma added the comment:
> I think it is *very* reasonable to expect that calling eval() on a string
> should have the exact same effect as if the code that is inside the eval had
> been written as part of the source code.
I don't think Python's execution model is defined
Cong Ma added the comment:
> The extra macros are provided by optional packages. On Fedora and
> Debian/Ubuntu the package is called autoconf-archive.
Thank you very much. This (and the patch) is clearing things up for me a lot.
At first I thought I was supposed to copy the m4 file
Cong Ma added the comment:
I think this is in the same class of behaviours as
```
def func(l):
def get(i):
return l[i]
print(eval("(lambda x: get(x))(0)")) # Call anonymous lambda with the
constant 0 as argument
```
Calls like ``func(["spam"
Cong Ma added the comment:
>From the configure.ac file:
> dnl ***
> dnl * Please run autoreconf to test your changes! *
> dnl ***
I take it to mean "if configure.ac is changed, run
Cong Ma added the comment:
> If you consider that there is a bug, please open a new issue since you closed
> this one.
Please see the follow up in Issue 43617.
Many thanks for bearing with me.
--
___
Python tracker
<https://bugs.p
Change by Cong Ma :
--
type: -> compile error
___
Python tracker
<https://bugs.python.org/issue43617>
___
___
Python-bugs-list mailing list
Unsubscrib
New submission from Cong Ma :
The problem
---
In the repository, the definition for ``AX_CHECK_COMPILE_FLAG`` in Python's
``configure.ac`` file is missing. If ``autoreconf`` is run, an invalid
``configure`` script is generated. The following is the behaviour of running
``autoreconf
Cong Ma added the comment:
BTW, do we need to fix the missing definition of the AX_CHECK_COMPILE_FLAG
macro in configure.ac? This is a separate problem, if a problem at all.
--
resolution: -> not a bug
stage: -> resolved
status: open -&g
Cong Ma added the comment:
Hello Victor,
I think you're right. This is bogus on my part. TL;DR: The Python version is
3.8 but I was trying to understand what's going on using the latest source.
Full version: I was trying to understand why the following C file when compiled
with -shared
New submission from Cong Ma :
(This is a summarized form of the commit message in the attached patch. I'm
submitting a patch instead of a PR over GitHub, because it seems that the
``autoreconf`` output files are part of the repository. In order for the
changes to take effect in the repo, I
Cong Ma added the comment:
> Idea: We could make this problem go away by making NaN a singleton.
Apart from the fact that NaN is not a specific value/object (as pointed out in
the previous message by @mark.dickinson), currently each builtin singleton
(None, True, False, etc.) in Pyt
Cong Ma added the comment:
Sorry, please ignore my rambling about "float() returning aliased object" -- in
that case the problem with hashing doesn't arise.
--
___
Python tracker
<https://bugs.python.o
Cong Ma added the comment:
Thank you @mark.dickinson for the detailed analysis.
In addition to your hypothetical usage examples, I am also trying to understand
the implications for user code.
If judging by the issues people open on GitHub like this:
https://github.com/pandas-dev/pandas
New submission from Cong Ma :
Summary: CPython hash all NaN values to 0. This guarantees worst-case behaviour
for dict if numerous existing keys are NaN. I think by hashing NaN using the
generic object (or "pointer") hash instead, the worst-case situation can be
alleviated withou
Hi,
I'd appreciate your hints on this problem. I'm writing a module in which several
functions can alter the value of a global variable (I know this sounds evil,
please forgive me...). What I'm trying to do is to eliminate the global foo
lines in those functions' bodies and to use a decorator for
Terry Reedy wrote:
Not to me. You are using the module as a singleton class. The
alternative is to write a class, make the functions methods, and
instantiate the class. If that instance must be a singleton, more work
is required. If multiple instances make sense, you can go the class
route
Gabriel Genellina wrote:
En Mon, 08 Dec 2008 12:34:03 -0200, Cong Ma [EMAIL PROTECTED] escribió:
I'm writing a program that pickles an instance of a custom subclass of
datetime.tzinfo. I followed the guides given in the Library Reference
(version
2.5.2, chapter 5.1.6), which contain
Hello,
I'm writing a program that pickles an instance of a custom subclass of
datetime.tzinfo. I followed the guides given in the Library Reference (version
2.5.2, chapter 5.1.6), which contain the note:
Special requirement for pickling: A tzinfo subclass must have an __init__
method that can be
Lawrence D'Oliveiro wrote:
for \
Entry \
in \
sorted \
(
f for f in os.listdir(PatchesDir) if PatchDatePat.search(f) !=
None
) \
:
Patch = (open,
gzip.GzipFile)[Entry.endswith(.gz)](os.path.join(PatchesDir, Entry), r)
...
alex23 wrote:
On Nov 26, 3:26 pm, greg [EMAIL PROTECTED] wrote:
os.O_DIRECTORY must be fairly new -- it doesn't exist
in my 2.5 installation. But os.O_RDONLY seems to work
just as well for this purpose.
Which OS are you using?
Python 2.5.2 (r252:60911, Jul 31 2008, 17:28:52)
[GCC 4.2.3
Nick Craig-Wood wrote:
Here is how you do exactly that in python using ctypes
from ctypes import CDLL, c_char_p, c_int, Structure, POINTER
from ctypes.util import find_library
class c_dir(Structure):
Opaque type for directory entries, corresponds to struct DIR
c_dir_p =
r0g wrote:
Cong Ma wrote:
Dear all,
Can you give me some hint on getting a directory file descriptor in Python?
Besides, what's good about os.fchdir() if I can't get a directory fd in the
first place?
Thanks for your reply.
Regards,
Cong.
for each in os.listdir(os.getcwd
alex23 wrote:
On Nov 26, 12:31 am, D'Arcy J.M. Cain [EMAIL PROTECTED] wrote:
Is this what you want?
ofiles = [open(x) for x in os.listdir(os.getcwd())]
'open' returns a file object, whereas the OP is after file
descriptors, which are returned by 'os.open'.
--
Dear all,
Can you give me some hint on getting a directory file descriptor in Python?
Besides, what's good about os.fchdir() if I can't get a directory fd in the
first place?
Thanks for your reply.
Regards,
Cong.
--
http://mail.python.org/mailman/listinfo/python-list
28 matches
Mail list logo