Coccinelle Archive on lore.kernel.org
 help / color / Atom feed
* [Cocci] Python 3.10 again: _Py_fopen deprecated
@ 2021-01-05 19:00 Richard W.M. Jones
  2021-01-08 22:42 ` Julia Lawall
  0 siblings, 1 reply; 4+ messages in thread
From: Richard W.M. Jones @ 2021-01-05 19:00 UTC (permalink / raw)
  To: cocci

Firstly a gentle reminder that there's a patch waiting to be applied:
https://systeme.lip6.fr/pipermail/cocci/2020-November/thread.html#8398

Different from that patch, but still related to Python 3.10, we've got
another bug report here:
https://bugzilla.redhat.com/show_bug.cgi?id=1912931

This time _Py_fopen has been deprecated, replaced by _Py_wfopen or
_Py_fopen_obj.  It's unclear which is better.  The two functions are
documented here:
https://github.com/python/cpython/blob/master/Python/fileutils.c#L1418

What I don't understand from the pyxml code is why we use these
internal Python functions at all, instead of calling regular C
functions like fopen etc.  In fact it seems like for Python 2 we did
call fopen ...

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW

_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Cocci] Python 3.10 again: _Py_fopen deprecated
  2021-01-05 19:00 [Cocci] Python 3.10 again: _Py_fopen deprecated Richard W.M. Jones
@ 2021-01-08 22:42 ` Julia Lawall
  2021-01-08 23:10   ` Thierry Martinez
  0 siblings, 1 reply; 4+ messages in thread
From: Julia Lawall @ 2021-01-08 22:42 UTC (permalink / raw)
  To: Richard W.M. Jones; +Cc: cocci



On Tue, 5 Jan 2021, Richard W.M. Jones wrote:

> Firstly a gentle reminder that there's a patch waiting to be applied:
> https://systeme.lip6.fr/pipermail/cocci/2020-November/thread.html#8398
>
> Different from that patch, but still related to Python 3.10, we've got
> another bug report here:
> https://bugzilla.redhat.com/show_bug.cgi?id=1912931
>
> This time _Py_fopen has been deprecated, replaced by _Py_wfopen or
> _Py_fopen_obj.  It's unclear which is better.  The two functions are
> documented here:
> https://github.com/python/cpython/blob/master/Python/fileutils.c#L1418
>
> What I don't understand from the pyxml code is why we use these
> internal Python functions at all, instead of calling regular C
> functions like fopen etc.  In fact it seems like for Python 2 we did
> call fopen ...

Everything should be up to date now on github.  Thanks for your help.
Thierry will contact you directly about the choice of fopen.

julia

>
> Rich.
>
> --
> Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
> Read my programming and virtualization blog: http://rwmj.wordpress.com
> Fedora Windows cross-compiler. Compile Windows programs, test, and
> build Windows installers. Over 100 libraries supported.
> http://fedoraproject.org/wiki/MinGW
>
> _______________________________________________
> Cocci mailing list
> Cocci@systeme.lip6.fr
> https://systeme.lip6.fr/mailman/listinfo/cocci
>
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Cocci] Python 3.10 again: _Py_fopen deprecated
  2021-01-08 22:42 ` Julia Lawall
@ 2021-01-08 23:10   ` Thierry Martinez
  2021-01-09  9:10     ` Richard W.M. Jones
  0 siblings, 1 reply; 4+ messages in thread
From: Thierry Martinez @ 2021-01-08 23:10 UTC (permalink / raw)
  To: Julia Lawall; +Cc: cocci

Hi, Richard.

Thank you very much for your two successive reports about
incompatibilities between pyml and Python 3.10. They should have been
fixed now.

Richard:
>> What I don't understand from the pyxml code is why we use these
>> internal Python functions at all, instead of calling regular C
>> functions like fopen etc.  In fact it seems like for Python 2 we did
>> call fopen ...

Indeed, for Python 2, there is a fallback to fopen since Py_fopen is not
available.  When Py_fopen or Py_wfopen are available, we prefer to use
them because they handle the Windows special case.

Best regards.
-- 
Thierry.

Julia Lawall :
> On Tue, 5 Jan 2021, Richard W.M. Jones wrote:
>
>> Firstly a gentle reminder that there's a patch waiting to be applied:
>> https://systeme.lip6.fr/pipermail/cocci/2020-November/thread.html#8398
>>
>> Different from that patch, but still related to Python 3.10, we've got
>> another bug report here:
>> https://bugzilla.redhat.com/show_bug.cgi?id=1912931
>>
>> This time _Py_fopen has been deprecated, replaced by _Py_wfopen or
>> _Py_fopen_obj.  It's unclear which is better.  The two functions are
>> documented here:
>> https://github.com/python/cpython/blob/master/Python/fileutils.c#L1418
>>
>> What I don't understand from the pyxml code is why we use these
>> internal Python functions at all, instead of calling regular C
>> functions like fopen etc.  In fact it seems like for Python 2 we did
>> call fopen ...
>
> Everything should be up to date now on github.  Thanks for your help.
> Thierry will contact you directly about the choice of fopen.
>
> julia
>
>>
>> Rich.
>>
>> --
>> Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
>> Read my programming and virtualization blog: http://rwmj.wordpress.com
>> Fedora Windows cross-compiler. Compile Windows programs, test, and
>> build Windows installers. Over 100 libraries supported.
>> http://fedoraproject.org/wiki/MinGW
>>
>> _______________________________________________
>> Cocci mailing list
>> Cocci@systeme.lip6.fr
>> https://systeme.lip6.fr/mailman/listinfo/cocci
>>
> _______________________________________________
> Cocci mailing list
> Cocci@systeme.lip6.fr
> https://systeme.lip6.fr/mailman/listinfo/cocci

_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Cocci] Python 3.10 again: _Py_fopen deprecated
  2021-01-08 23:10   ` Thierry Martinez
@ 2021-01-09  9:10     ` Richard W.M. Jones
  0 siblings, 0 replies; 4+ messages in thread
From: Richard W.M. Jones @ 2021-01-09  9:10 UTC (permalink / raw)
  To: Thierry Martinez; +Cc: cocci

On Sat, Jan 09, 2021 at 12:10:18AM +0100, Thierry Martinez wrote:
> Hi, Richard.
> 
> Thank you very much for your two successive reports about
> incompatibilities between pyml and Python 3.10. They should have been
> fixed now.
> 
> Richard:
> >> What I don't understand from the pyxml code is why we use these
> >> internal Python functions at all, instead of calling regular C
> >> functions like fopen etc.  In fact it seems like for Python 2 we did
> >> call fopen ...
> 
> Indeed, for Python 2, there is a fallback to fopen since Py_fopen is not
> available.  When Py_fopen or Py_wfopen are available, we prefer to use
> them because they handle the Windows special case.

Oh I see, that makes sense.

Rich.

> Best regards.
> -- 
> Thierry.
> 
> Julia Lawall :
> > On Tue, 5 Jan 2021, Richard W.M. Jones wrote:
> >
> >> Firstly a gentle reminder that there's a patch waiting to be applied:
> >> https://systeme.lip6.fr/pipermail/cocci/2020-November/thread.html#8398
> >>
> >> Different from that patch, but still related to Python 3.10, we've got
> >> another bug report here:
> >> https://bugzilla.redhat.com/show_bug.cgi?id=1912931
> >>
> >> This time _Py_fopen has been deprecated, replaced by _Py_wfopen or
> >> _Py_fopen_obj.  It's unclear which is better.  The two functions are
> >> documented here:
> >> https://github.com/python/cpython/blob/master/Python/fileutils.c#L1418
> >>
> >> What I don't understand from the pyxml code is why we use these
> >> internal Python functions at all, instead of calling regular C
> >> functions like fopen etc.  In fact it seems like for Python 2 we did
> >> call fopen ...
> >
> > Everything should be up to date now on github.  Thanks for your help.
> > Thierry will contact you directly about the choice of fopen.
> >
> > julia
> >
> >>
> >> Rich.
> >>
> >> --
> >> Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
> >> Read my programming and virtualization blog: http://rwmj.wordpress.com
> >> Fedora Windows cross-compiler. Compile Windows programs, test, and
> >> build Windows installers. Over 100 libraries supported.
> >> http://fedoraproject.org/wiki/MinGW
> >>
> >> _______________________________________________
> >> Cocci mailing list
> >> Cocci@systeme.lip6.fr
> >> https://systeme.lip6.fr/mailman/listinfo/cocci
> >>
> > _______________________________________________
> > Cocci mailing list
> > Cocci@systeme.lip6.fr
> > https://systeme.lip6.fr/mailman/listinfo/cocci

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v

_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-05 19:00 [Cocci] Python 3.10 again: _Py_fopen deprecated Richard W.M. Jones
2021-01-08 22:42 ` Julia Lawall
2021-01-08 23:10   ` Thierry Martinez
2021-01-09  9:10     ` Richard W.M. Jones

Coccinelle Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/cocci/0 cocci/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 cocci cocci/ https://lore.kernel.org/cocci \
		cocci@systeme.lip6.fr
	public-inbox-index cocci

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/fr.lip6.systeme.cocci


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git