gnulib-tool.py: Fix pylint 'attribute-defined-outside-init' warnings.

2024-04-16 Thread Collin Funk
I mentioned a change involving moving an attribute definition to its proper place in __init__ here: https://lists.gnu.org/archive/html/bug-gnulib/2024-04/msg00270.html But I noticed that pylint will warn about these [1]. So it seems easier to fix them all at once instead of in the middle of o

Re: Refactoring rewrite_filename functions

2024-04-16 Thread Collin Funk
On 4/16/24 6:35 PM, Bruno Haible wrote: > This does not make sense. GLConfig is meant to hold settings and > configuration, > nothing more. > > I see the home of this function more in GLFileSystem.py. Maybe in class > GLFileAssistant, maybe in a new class in that same file. Hmm, thanks for the a

Re: Refactoring rewrite_filename functions

2024-04-16 Thread Bruno Haible
Hi Collin, > I'm thinking of making this function accept a single filename instead > of a list Makes sense, as previously discussed. > and then moving it to GLConfig. This does not make sense. GLConfig is meant to hold settings and configuration, nothing more. I see the home of this function m

Refactoring rewrite_filename functions

2024-04-16 Thread Collin Funk
Hi Bruno, On 4/16/24 8:09 AM, Bruno Haible wrote: > I'm talking about this piece of code: > > filetable = [] > for src in filelist: > dest = self.rewrite_files([src])[-1] > filetable.append(tuple([dest, src])) > > which can be written as > > filet

Re: [PATCH] Fix wchar_h.m4 serial number

2024-04-16 Thread Bruno Haible
Hi Sam, > * m4/wchar_h.m4: Remove duplicate serial number specification and increment > serial. Thanks, applied. > (It's easier for some work I'm doing if each serial maps to one checksum > of the macro, and serial #s are free.) We cannot guarantee this. For example, if we make a comment-only

[PATCH] Fix wchar_h.m4 serial number

2024-04-16 Thread Sam James
Remove duplicate serial number specification (the latter of which is invalid) and increment the serial to reflect this change. (It's easier for some work I'm doing if each serial maps to one checksum of the macro, and serial #s are free.) * m4/wchar_h.m4: Remove duplicate serial number specificat

Re: gnulib-tool.py: Make GLModule's __eq__ and __hash__ method agree.

2024-04-16 Thread Bruno Haible
Hi Collin, > From the documentation of object.__hash__(self) [1]: > > The only required property is that objects which compare equal > have the same hash value; it is advised to mix together the hash > values of the components of the object that also play a part in > compariso

new modules setpayloadsig, setpayloadsigf, setpayloadsigl

2024-04-16 Thread Bruno Haible
ISO C 23 specifies in the (optional, but normative) Annex F also functions for creating signalling NaNs with a given payload. Here is a patch series that implements them. 2024-04-16 Bruno Haible setpayloadsigl: Add tests. * tests/test-setpayloadsigl.c: New file, based on

Re: new modules setpayload, setpayloadf, setpayloadl

2024-04-16 Thread Bruno Haible
> setpayloadl: New module. Oops, it appears that I had not correctly tested this on some platforms. With these two fixes, it should be better. 2024-04-16 Bruno Haible setpayloadl: Fix platform-specific bugs. * lib/setpayloadl.c (setpayloadl): On m68k, consider the actua

Re: Simplified Python caching

2024-04-16 Thread Bruno Haible
> > Using '@lru_cache(maxsize=None)' would let Python deal with all of > > this caching for us. > > It's better to not do it, and keep the code as-is. I gave > Two reasons: > > * As I already mentioned, it's good to keep the code understandable, > without going "all-in" on all possible fea

gnulib-tool.py: Make GLModule's __eq__ and __hash__ method agree.

2024-04-16 Thread Collin Funk
>From the documentation of object.__hash__(self) [1]: The only required property is that objects which compare equal have the same hash value; it is advised to mix together the hash values of the components of the object that also play a part in comparison of objects by packing

Re: gnulib-tool.py: Make data structures more clear.

2024-04-16 Thread Bruno Haible
Collin Funk wrote: > Patch 0001 changes GLModuleTable's unconditionals member from a > dictionary to a set. > ... > PEP 8 makes this recommendation for 'is not' and 'not ... is' for > similar reasons [1]. Thanks. Both patches applied. Bruno

Re: Simplified Python caching

2024-04-16 Thread Collin Funk
Hi Bruno, On 4/16/24 8:47 AM, Bruno Haible wrote: > Yes, they _can_ be made static, but they can also be left as-is. And so, > as a developer, you start to spend time considering whether to make a > function static or not. That time is not well spent. We are in agreement there. PyCharm gives hint

Re: gnulib-tool.py: Remove a redundant function.

2024-04-16 Thread Collin Funk
Hi Bruno, On 4/16/24 8:09 AM, Bruno Haible wrote: > I'm talking about this piece of code: > > filetable = [] > for src in filelist: > dest = self.rewrite_files([src])[-1] > filetable.append(tuple([dest, src])) > > which can be written as > > filet

Re: gnulib-tool.py: Make data structures more clear.

2024-04-16 Thread Collin Funk
On 4/16/24 9:06 AM, Collin Funk wrote: > Patch 0001 changes GLModuleTable's unconditionals member from a > dictionary to a set. Forgot attachments, oops. CollinFrom be8c8ce23d090269f52124630b1b0b4d6034052e Mon Sep 17 00:00:00 2001 From: Collin Funk Date: Tue, 16 Apr 2024 08:21:27 -0700 Subject:

gnulib-tool.py: Make data structures more clear.

2024-04-16 Thread Collin Funk
Patch 0001 changes GLModuleTable's unconditionals member from a dictionary to a set. Since we only use it to check membership in GLModuleTable.addConditional() it is effectively a set anyways. Then in GLModuleTable.addUnconditional() we have: self.unconditionals.add(str(module)) instead of:

Re: Simplified Python caching

2024-04-16 Thread Bruno Haible
Hi Collin, > I don't necessarily disagree with your point about the use of > higher-order functions. I found decorator functions really confusing > when I first started using Python ;-) > I make an exception to this rule for decorators that are a part of the > Python language or standard library

Re: gnulib-tool.py: Remove a redundant function.

2024-04-16 Thread Bruno Haible
Hi Collin, > But I think the idea of the patch is still > correct. Since it doesn't make sense to accept a list and then only > use it with one element lists. Sure. This code structure comes from the fact that in the shell implementation, the rewriting of file names is done through a 'sed' invoca

new modules setpayload, setpayloadf, setpayloadl

2024-04-16 Thread Bruno Haible
ISO C 23 specifies in the (optional, but normative) Annex F functions for creating NaNs with payload. glibc has these functions already since 2017. But portable programs cannot use them, if Gnulib does not implement them as well. Therefore, this set of patches implements them. 2024-04-16 Bruno