Repository: nvaccess/nvda

Issue:
Alpha snaps recently broke Audio Themes add-on


### Steps to reproduce:
Run or install the alpha snapshot nvda_snapshot_alpha-24329,d3444424.exe

or later. The running copy will pick up the condition of add ons of course. Sound themes can be the only add on. The non working version is at 
https://www.dropbox.com/s/i5git9fn8gzjmma/audiothemes_6.0_Gen.nvda-addon?dl=1

### Actual behavior:

When this or later alpha snaps are used, there is an error noise, and although when you select continue running you can see the add on control panel, it does not work producing the error if you alter anything, just like when nvda starts or reboots after the add on is installed. Also noted is that nvda seems to be starting over the top of the closing tones, which the previous version does not. The version which works with this add on is: nvda_snapshot_alpha-25732,527e54c7.exe


### Expected behavior:

The add on should make the default sounds as it does in the earlier snap, and the control panel should also work.
### System configuration

Windows 7 pro, latest updates, 8gig ram.  add ons loaded, since bit pointless if they are not.


#### NVDA portable/

#### NVDA version:

See above, the current stable and beta/rc version  of course show no issues.

#### Windows version:
7 Pro, but should not make any difference.

#### Name and version of other software in use when reproducing the issue:
It happens as nvda is starting and remains inoperative till you chang back to the previous alpha or a stable version. Also, iit seems not to matter if its in continue running mode or portable install.

#### Other information about your system:
Its using external sound box, but its been the same for many years. It is of course 64 bit Windows, 

### Other questions
#### Does the issue still occur after restarting your computer?
Yes
#### Have you tried any other versions of NVDA? If so, please report their behaviors.
See above
#### If add-ons are disabled, is your problem still occurring?
Obviously not! However I do notice that you cannot restart with add ons disabled if in continue running mode, which is a little strange.
#### Does the issue still occur after you run the COM Registration Fixing Tool in NVDA's tools menu?
Yes
I will try to add a file with the two complete logs in a zip file


Discussion:
Hi Brian

nvda_snapshot_alpha-24329,d3444424.exe is quite old (Dec 9, 2021).

One thing to take into account is that some controlType attributes have been removed during the alpha stage of 2022.1 dev cycle, but have been reintroduced during beta stage of 2022.1 dev cycle. Thus, there is probably a range of old alpha snapshots for which the add-on does not work but that's not the range we are targetting.

If NVDA 2022.1 is working fine, there is surely a more recent alpha build which is still working correctly.

Could you please try to identify the most recent build which is working correctly?
To help identifying it:
* Do you test alpha snapshots regularly, i.e. on a daily or weekly basis?
* If yes, do you remember when the issue began to appear?

Also one thing to remember is that the error tone is issued by default in alpha and beta build only, not in rc and stable builds.


I'm sure these were the ones. I went to the page, and downloaded the latest 
and prior. I have no idea how the numbering works. I just cut and pasted the 
filenames.

 Are we sure they are wrong, or has the alpha list moved?
 Brian

-- 
***@***.***
Sent via blueyonder.(Virgin media)
Please address personal E-mail to:-
***@***.***, putting 'Brian Gaff'
in the display name field.
----- Original Message ----- 
From: "Cyrille Bougot" ***@***.***>
To: "nvaccess/nvda" ***@***.***>
Cc: "Brian Gaff" ***@***.***>; "Author" 
***@***.***>
Sent: Tuesday, July 19, 2022 9:48 AM
Subject: Re: [nvaccess/nvda] Alpha snaps recently broke working add on 
(Issue #13923)


> Hi Brian
>
> nvda_snapshot_alpha-24329,d3444424.exe is quite old (Dec 9, 2021).
>
> One thing to take into account is that some controlType attributes have 
> been removed during the alpha stage of 2022.1 dev cycle, but have been 
> reintroduced during beta stage of 2022.1 dev cycle. Thus, there is 
> probably a range of old alpha snapshots for which the add-on does not work 
> but that's not the range we are targetting.
>
> If NVDA 2022.1 is working fine, there is surely a more recent alpha build 
> which is still working correctly.
>
> Could you please try to identify the most recent build which is working 
> correctly?
> To help identifying it:
> * Do you test alpha snapshots regularly, i.e. on a daily or weekly basis?
> * If yes, do you remember when the issue began to appear?
>
> Also one thing to remember is that the error tone is issued by default in 
> alpha and beta build only, not in rc and stable builds.
>
>
>
> -- 
> Reply to this email directly or view it on GitHub:
> https://github.com/nvaccess/nvda/issues/13923#issuecomment-1188776586
> You are receiving this because you authored the thread.
>
> Message ID: ***@***.***> 


PS the log files, have the numbers at the top are these the right ones or 
the wrong ones. I looked at the dates too. Very odd.
 Brian

-- 
***@***.***
Sent via blueyonder.(Virgin media)
Please address personal E-mail to:-
***@***.***, putting 'Brian Gaff'
in the display name field.
----- Original Message ----- 
From: "Cyrille Bougot" ***@***.***>
To: "nvaccess/nvda" ***@***.***>
Cc: "Brian Gaff" ***@***.***>; "Author" 
***@***.***>
Sent: Tuesday, July 19, 2022 9:48 AM
Subject: Re: [nvaccess/nvda] Alpha snaps recently broke working add on 
(Issue #13923)


> Hi Brian
>
> nvda_snapshot_alpha-24329,d3444424.exe is quite old (Dec 9, 2021).
>
> One thing to take into account is that some controlType attributes have 
> been removed during the alpha stage of 2022.1 dev cycle, but have been 
> reintroduced during beta stage of 2022.1 dev cycle. Thus, there is 
> probably a range of old alpha snapshots for which the add-on does not work 
> but that's not the range we are targetting.
>
> If NVDA 2022.1 is working fine, there is surely a more recent alpha build 
> which is still working correctly.
>
> Could you please try to identify the most recent build which is working 
> correctly?
> To help identifying it:
> * Do you test alpha snapshots regularly, i.e. on a daily or weekly basis?
> * If yes, do you remember when the issue began to appear?
>
> Also one thing to remember is that the error tone is issued by default in 
> alpha and beta build only, not in rc and stable builds.
>
>
>
> -- 
> Reply to this email directly or view it on GitHub:
> https://github.com/nvaccess/nvda/issues/13923#issuecomment-1188776586
> You are receiving this because you authored the thread.
>
> Message ID: ***@***.***> 


Well, whereas the current new stable is working with sound themes, the whole 
lot of the current alphas is not. I'm totally confused as I thought at least 
omegas,  but now not. I'll have to await till I get more time to look into 
this, as the currently available list  starts in April, and I'm sure the 
snap I had was earlier in the year, but of course, I no longer have it!

All I can do is later on publish the log from the oldest and newest alpha 
and see if anyone can make any sense of it. Its very strange.
 Brian

-- 
***@***.***
Sent via blueyonder.(Virgin media)
Please address personal E-mail to:-
***@***.***, putting 'Brian Gaff'
in the display name field.
----- Original Message ----- 
From: "Cyrille Bougot" ***@***.***>
To: "nvaccess/nvda" ***@***.***>
Cc: "Brian Gaff" ***@***.***>; "Author" 
***@***.***>
Sent: Tuesday, July 19, 2022 9:48 AM
Subject: Re: [nvaccess/nvda] Alpha snaps recently broke working add on 
(Issue #13923)


> Hi Brian
>
> nvda_snapshot_alpha-24329,d3444424.exe is quite old (Dec 9, 2021).
>
> One thing to take into account is that some controlType attributes have 
> been removed during the alpha stage of 2022.1 dev cycle, but have been 
> reintroduced during beta stage of 2022.1 dev cycle. Thus, there is 
> probably a range of old alpha snapshots for which the add-on does not work 
> but that's not the range we are targetting.
>
> If NVDA 2022.1 is working fine, there is surely a more recent alpha build 
> which is still working correctly.
>
> Could you please try to identify the most recent build which is working 
> correctly?
> To help identifying it:
> * Do you test alpha snapshots regularly, i.e. on a daily or weekly basis?
> * If yes, do you remember when the issue began to appear?
>
> Also one thing to remember is that the error tone is issued by default in 
> alpha and beta build only, not in rc and stable builds.
>
>
>
> -- 
> Reply to this email directly or view it on GitHub:
> https://github.com/nvaccess/nvda/issues/13923#issuecomment-1188776586
> You are receiving this because you authored the thread.
>
> Message ID: ***@***.***> 


It's still unclear what the issue is here.

Does the add-on not work as expected?
What do you expect the add-on to do?
What are the steps to reproduce the problem with the add-on and NVDA?
I have extracted from the add-on a code snipet which causes the issue. To test, you can just execute this code in the console and check if the error occurs or not.
```
import ctypes
import collections.abc
length = 4  # I put here any value; I do not know what it really was in the add-on
buff = (ctypes.c_float * length)()
# circumvent automatic conversion of iterables.
buff_ptr = ctypes.POINTER(ctypes.c_float)()
buff_ptr.contents = buff
# Below is the instruction causing the error in the last alpha releases:
condition = isinstance(buff_ptr.contents, collections.abc.Sized)
```

There is no issue until alpha-25819,365f4f0c (included).
The first alpha to show the issue is alpha-25824,9172c09a. It corresponds to the merge of #13851.

In #13851, I guess that the only modification which can cause this issue is the addition of the following lines in requirements.txt:
```
# Requirements for type checking.
# typing_extensions is incorporated in py3.8+, also available via mypy
typing_extensions==4.3.0

```

I do not plan to find the fix for it.
@seanbudd, @michaelDCurran please continue the work. Thanks.


I've looked into this briefly and it seems that as long as `typing.Collection` is not in `FeatureFlagEnumProtocol` MRO everything works as it should. I cannot reproduce this from the standard interpreter unfortunately.
The  STR can be simplified to:
```
import collections.abc
isinstance(12, collections.abc.Sized)
```

Thanks for that, I just could not find the right version when I looked. I'm 
a bit busy with a charity at the moment and being distracted every hour or 
so at my age, is not a good idea.
 Beware don't grow old!
 Brian

-- 
***@***.***
Sent via blueyonder.(Virgin media)
Please address personal E-mail to:-
***@***.***, putting 'Brian Gaff'
in the display name field.
----- Original Message ----- 
From: "Cyrille Bougot" ***@***.***>
To: "nvaccess/nvda" ***@***.***>
Cc: "Brian Gaff" ***@***.***>; "Author" 
***@***.***>
Sent: Friday, July 22, 2022 2:23 PM
Subject: Re: [nvaccess/nvda] Alpha snaps recently broke Audio Themes add-on 
(Issue #13923)


>I have extracted from the add-on a code snipet which causes the issue. To 
>test, you can just execute this code in the console and check if the error 
>occurs or not.
> ```
> import ctypes
> import collections.abc
> length = 4  # I put here any value; I do not know what it really was in 
> the add-on
> buff = (ctypes.c_float * length)()
> # circumvent automatic conversion of iterables.
> buff_ptr = ctypes.POINTER(ctypes.c_float)()
> buff_ptr.contents = buff
> # Below is the instruction causing the error in the last alpha releases:
> condition = isinstance(buff_ptr.contents, collections.abc.Sized)
> ```
>
> There is no issue until alpha-25819,365f4f0c (included).
> The first alpha to show the issue is alpha-25824,9172c09a. It corresponds 
> to the merge of #13851.
>
> In #13851, I guess that the only modification which can cause this issue 
> is the addition of the following lines in requirements.txt:
> ```
> # Requirements for type checking.
> # typing_extensions is incorporated in py3.8+, also available via mypy
> typing_extensions==4.3.0
>
> ```
>
> I do not plan to find the fix for it.
> @seanbudd, @michaelDCurran please continue the work. Thanks.
>
>
>
> -- 
> Reply to this email directly or view it on GitHub:
> https://github.com/nvaccess/nvda/issues/13923#issuecomment-1192570671
> You are receiving this because you authored the thread.
>
> Message ID: ***@***.***> 


So does this mean then, that a slightly updated version of Python itself 
has a bug or at least an undocumented change?

 If somebody can instruct me which file to edit and what to make it, I'll 
give it a try.
 Brian

-- 
***@***.***
Sent via blueyonder.(Virgin media)
Please address personal E-mail to:-
***@***.***, putting 'Brian Gaff'
in the display name field.
----- Original Message ----- 
From: "Łukasz Golonka" ***@***.***>
To: "nvaccess/nvda" ***@***.***>
Cc: "Brian Gaff" ***@***.***>; "Author" 
***@***.***>
Sent: Friday, July 22, 2022 7:26 PM
Subject: Re: [nvaccess/nvda] Alpha snaps recently broke Audio Themes add-on 
(Issue #13923)


> The  STR can be simplified to:
> ```
> import collections.abc
> isinstance(12, collections.abc.Sized)
> ```
>
>
> -- 
> Reply to this email directly or view it on GitHub:
> https://github.com/nvaccess/nvda/issues/13923#issuecomment-1192833149
> You are receiving this because you authored the thread.
>
> Message ID: ***@***.***> 



Resolving patch:
diff --git a/source/config/featureFlagEnums.py b/source/config/featureFlagEnums.py
--- a/source/config/featureFlagEnums.py
+++ b/source/config/featureFlagEnums.py
@@ -23,7 +23,7 @@
 )
 
 
-class FeatureFlagEnumProtocol(Protocol, typing.Collection):
+class FeatureFlagEnumProtocol(Protocol):
 	""" All feature flags are expected to have a "DEFAULT" value.
 	This definition is provided only for type annotations
 	"""


Test patch: