Re: PyObject_CallFunctionObjArgs segfaults

2022-09-29 Thread MRAB
On 2022-09-30 01:02, MRAB wrote: On 2022-09-29 23:41, Jen Kris wrote: I just solved this C API problem, and I’m posting the answer to help anyone else who might need it. [snip] What I like to do is write comments that state which variables hold a reference, followed by '+' if it's a new r

Re: PyObject_CallFunctionObjArgs segfaults

2022-09-29 Thread MRAB
On 2022-09-29 23:41, Jen Kris wrote: I just solved this C API problem, and I’m posting the answer to help anyone else who might need it. The errors were: (1) we must call Py_INCREF on each object when it’s created. Some functions return an object that has already been incref'ed ("new refer

Re: python developer

2022-09-29 Thread Mike Dewhirst
On 30/09/2022 5:09 am, Walid AlMasri wrote: Hi all, I has been using python in scientific computing for many years I want to become a python developer so what is a good reference to follow ? A developer makes products whereas a scientist understands complexities. I would recommend reading ab

Re: PyObject_CallFunctionObjArgs segfaults

2022-09-29 Thread Jen Kris via Python-list
I just solved this C API problem, and I’m posting the answer to help anyone else who might need it.  The errors were: (1) we must call Py_INCREF on each object when it’s created. (2) in C_API_2 (see below) we don’t cast value_1 as I did before with PyObject * value_ptr = (PyObject * )value_1

Re: PyObject_CallFunctionObjArgs segfaults

2022-09-29 Thread MRAB
On 2022-09-29 21:47, Jen Kris wrote: To update my previous email, I found the problem, but I have a new problem. Previously I cast PyObject * value_ptr = (PyObject * )value_1 but that's not correct.  Instead I used PyObject * value_ptr = PyLong_FromLong(value_1) and that works.  HOWEVER, whil

Re: PyObject_CallFunctionObjArgs segfaults

2022-09-29 Thread Jen Kris via Python-list
To update my previous email, I found the problem, but I have a new problem.  Previously I cast PyObject * value_ptr = (PyObject * )value_1 but that's not correct.  Instead I used PyObject * value_ptr = PyLong_FromLong(value_1) and that works.  HOWEVER, while PyObject_CallFunctionObjArgs does wo

Re: PyObject_CallFunctionObjArgs segfaults

2022-09-29 Thread Jen Kris via Python-list
Thanks very much to @MRAB for taking time to answer.  I changed my code to conform to your answer (as best I understand your comments on references), but I still get the same error.  My comments continue below the new code immediately below.  int64_t Get_LibModules(int64_t * return_array) { Py

python developer

2022-09-29 Thread Walid AlMasri
Hi all, I has been using python in scientific computing for many years I want to become a python developer so what is a good reference to follow ? Thanks in advance ! Walid -- https://mail.python.org/mailman/listinfo/python-list

Re: non-standard glibc location

2022-09-29 Thread Sandi Cimerman
On Friday, September 8, 2017 at 3:16:12 AM UTC+2, Fetchinson . wrote: > On 9/7/17, Thomas Jollans wrote: > > On 2017-09-06 16:14, Fetchinson . via Python-list wrote: > >> Hi folks, > >> > >> I'm trying to install a binary package (tensorflow) which contains > >> some binary C extensions. Now

Re: on implementing a toy oop-system

2022-09-29 Thread Meredith Montgomery
r...@zedat.fu-berlin.de (Stefan Ram) writes: [...] >>>However, to evaluate a method call such as "o.m( a, a1, ... )", >>>currying does not necessarily have to be used. One can as well >>>determine the function to be used for "m" from the type of "o" >>>and then call that function with arguments

Re: Implementation of an lru_cache() decorator that ignores the first argument

2022-09-29 Thread Robert Latest via Python-list
Hi Chris and dh, thanks for your --as usually-- thoughtful and interesting answers. Indeed, when doing these web applications I find that there are several layers of useful, maybe less useful, and unknown caching. Many of my requests rely on a notoriously unreliable read-only database outside of m

Re: on implementing a toy oop-system

2022-09-29 Thread Meredith Montgomery
r...@zedat.fu-berlin.de (Stefan Ram) writes: > Meredith Montgomery writes: >>The code below works, but you can see it's kinda ugly. I wish I could >>uncurry a procedure, but I don't think this is possible. (Is it?) > > from functools import partial > from operator import add > add5 = partial( a

Re: PyObject_CallFunctionObjArgs segfaults

2022-09-29 Thread MRAB
On 2022-09-29 16:54, Jen Kris via Python-list wrote: Recently I completed a project where I used PyObject_CallFunctionObjArgs extensively with the NLTK library from a program written in NASM, with no problems.  Now I am on a new project where I call the Python random library.  I use the same s

PyObject_CallFunctionObjArgs segfaults

2022-09-29 Thread Jen Kris via Python-list
Recently I completed a project where I used PyObject_CallFunctionObjArgs extensively with the NLTK library from a program written in NASM, with no problems.  Now I am on a new project where I call the Python random library.  I use the same setup as before, but I am getting a segfault with random

Re: on GNU EMACS's python-mode, loading entire buffer

2022-09-29 Thread Stephen Berman
On Sun, 04 Sep 2022 16:47:07 -0300 Meredith Montgomery wrote: > Meredith Montgomery writes: > >> Meredith Montgomery writes: >> >> [...] >> >>> I would also be interested in a command that restarts the REPL afresh >>> and reloads my buffer --- sort of like keyboard's [F5] of the IDLE. >> >> A