internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: nvaccess/nvda

Issue:
after starting, nvda alpha-17205,93ccd518 reports errors and does not process its commands
In last alpha (17205... - fryday snapshot) nvda reports errors and does not process its keyboard commands. It happened when I tried to update from tuesday's snaphot (alpha-17162,2f60bc16). If I tried to run clean setup without any changes or installed addons directly from the snapshots page, it works fine

### Steps to reproduce:

- run tuesday snapshot
- make some changes like create a profile and install some addons
- try to update

### Actual behavior:

many error sounds and NVDA does not process its commands like nvda+f12 script for say time. and it happens also when trying with addons disabled after restart.

### Expected behavior:

normal startup, so I could work smoothly.

### System configuration
#### NVDA installed/portable/running from source:

installed and portable

#### NVDA version:

alpha-17205,93ccd518 (not tested earlier fryday and thursday snapshot yet)

#### Windows version:

Windows version: Windows 10Ver1809 (64-bit) build 17763.475

#### Name and version of other software in use when reproducing the issue:

n/a

#### Other information about your system:

### Other questions
#### Does the issue still occur after restarting your PC?

yes

#### Have you tried any other versions of NVDA? If so, please report their behaviors.

yes. last tested snapshot, which works fine, is alpha-17162,2f60bc16

### NVDA Logs:

[NVDA DNEVNIKI.zip](https://github.com/nvaccess/nvda/files/3170652/NVDA.DNEVNIKI.zip)



Discussion:

Resolving patch:
diff --git a/source/globalCommands.py b/source/globalCommands.py
--- a/source/globalCommands.py
+++ b/source/globalCommands.py
@@ -2432,13 +2432,15 @@ def __new__(cls, *args, **kwargs):
 
 	@classmethod
 	def _getScriptNameForProfile(cls, name):
+		name = name.encode("utf-8")
 		invalidChars = set()
 		for c in name:
 			if not c.isalnum() and c != "_":
 				invalidChars.add(c)
 		for c in invalidChars:
 			name=name.replace(c, b16encode(c))
-		return str("profile_%s" % name)
+		# Python 3: Revisit this to ensure that script names are decoded correctly
+		return "profile_%s" % name
 
 	@classmethod
 	def _profileScript(cls, name):


Test patch:
Repository: nvaccess/nvda

Issue:
Python Console: Preserve the result of the last executed command
<!--
Please thoroughly read NVDA's wiki article on how to fill in this template, including how to provide the required files.
Issues may be closed if the required information is not present.
https://github.com/nvaccess/nvda/wiki/Github-issue-template-explanation-and-examples
-->

### Is your feature request related to a problem? Please describe.

The NVDA Python Console implementation prevents clobbering of the gettext `_` built-in but at the same time prevents the user from taking advantage of the standard `sys.displayhook` saving the last returned value under that same name.

### Describe the solution you'd like

Best of both worlds: Gettext not clobbered and last returned value accessible as the underscore variable.

### Describe alternatives you've considered

### Additional context

Upcoming PR


Discussion:

Resolving patch:
diff --git a/source/pythonConsole.py b/source/pythonConsole.py
--- a/source/pythonConsole.py
+++ b/source/pythonConsole.py
@@ -102,6 +102,7 @@ def __init__(self, outputFunc, setPromptFunc, exitFunc, echoFunc=None, **kwargs)
 		# Can't use super here because stupid code.InteractiveConsole doesn't sub-class object. Grrr!
 		code.InteractiveConsole.__init__(self, locals=self.namespace, **kwargs)
 		self.prompt = ">>>"
+		self.lastResult = None
 
 	def _set_prompt(self, prompt):
 		self._prompt = prompt
@@ -121,8 +122,14 @@ def push(self, line):
 		sys.stdout = sys.stderr = self
 		# Prevent this from messing with the gettext "_" builtin.
 		saved_ = __builtin__._
+		self.lastResult = None
 		more = code.InteractiveConsole.push(self, line)
 		sys.stdout, sys.stderr = stdout, stderr
+		if __builtin__._ is not saved_:
+			self.lastResult = __builtin__._
+			# Preserve the namespace if gettext has explicitly been pushed there 
+			if "_" not in self.namespace or self.namespace["_"] is not saved_:
+				self.namespace["_"] = __builtin__._
 		__builtin__._ = saved_
 		self.prompt = "..." if more else ">>>"
 		return more


Test patch:
Repository: nvaccess/nvda

Issue:
App module handler/system tests: "does app module exist" function throws attribute error if invoked from system test spy
Hi,

First of several major issues for system tests:

### Steps to reproduce:
1. Check out Python 3 staging branch.
2. Apply fixes such as basestring to str.
3. Run system tests (scons systemTests).

### Actual behavior:
appModuleHandler.doesAppModuleExist function throws AttributeError, causing system tests to fail.

### Expected behavior:
System test passes.

### System configuration
#### NVDA installed/portable/running from source:
Source

#### NVDA version:
Python 3 staging

#### Windows version:
Windows 10 Version 1903

#### Name and version of other software in use when reproducing the issue:
None

#### Other information about your system:
None

### Other questions
#### Does the issue still occur after restarting your PC?
Yes

#### Have you tried any other versions of NVDA? If so, please report their behaviors.
Python 2: system test passes.

### Additional context:
When system test spy is run, app module handler isn't initialized, causing importers (a private list) to remain uninitialized - remain None. Python 3 is strict about this. One solution is to catch attribute error in the affected function.

Thanks.


Discussion:

Resolving patch:
diff --git a/source/appModuleHandler.py b/source/appModuleHandler.py
--- a/source/appModuleHandler.py
+++ b/source/appModuleHandler.py
@@ -153,6 +153,9 @@ def cleanup():
 			log.exception("Error terminating app module %r" % deadMod)
 
 def doesAppModuleExist(name):
+	# #9797: when invoked from system tests, importers list isn't initialized (attribute error on a None object), thus assume no app module exists.
+	if _importers is None:
+		return False
 	return any(importer.find_module("appModules.%s" % name) for importer in _importers)
 
 def fetchAppModule(processID,appName):


Test patch:
Repository: nvaccess/nvda

Issue:
Python 3: changing the log level doesn't do anything
### Steps to reproduce:
1. Start NVDA's threshold_py3_staging branch with logging set to a particular level
2. From the configuration, change the level.

### Actual behavior:
The actual level doesn't change at all.

### Expected behavior:
The level is changed appropriately

### Additional details
I can only make NVDA log at level debug if I explicitly restart NVDA with debug logging enabled. In other cases, all debug logging is silently discarded.




Discussion:

Resolving patch:
diff --git a/source/logHandler.py b/source/logHandler.py
--- a/source/logHandler.py
+++ b/source/logHandler.py
@@ -1,6 +1,6 @@
 #logHandler.py
 #A part of NonVisual Desktop Access (NVDA)
-#Copyright (C) 2007-2018 NV Access Limited, Rui Batista, Joseph Lee
+#Copyright (C) 2007-2019 NV Access Limited, Rui Batista, Joseph Lee, Leonard de Ruijter
 #This file is covered by the GNU General Public License.
 #See the file COPYING for more details.
 
@@ -139,7 +139,7 @@ def _log(self, level, msg, args, exc_info=None, extra=None, codepath=None, activ
 			msg += ("\nStack trace:\n"
 				+ stripBasePathFromTracebackText("".join(traceback.format_list(stack_info)).rstrip()))
 
-		res = logging.Logger._log(self,level, msg, args, exc_info, extra)
+		res = super()._log(level, msg, args, exc_info, extra)
 
 		if activateLogViewer:
 			# Make the log text we just wrote appear in the log viewer.
@@ -259,9 +259,11 @@ def redirectStdout(logger):
 	sys.stdout = StreamRedirector("stdout", logger, logging.WARNING)
 	sys.stderr = StreamRedirector("stderr", logger, logging.ERROR)
 
+# Register our logging class as the class for all loggers.
+logging.setLoggerClass(Logger)
 #: The singleton logger instance.
 #: @type: L{Logger}
-log = Logger("nvda")
+log = logging.getLogger("nvda")
 
 def _getDefaultLogFilePath():
 	if getattr(sys, "frozen", None):


Test patch:
Repository: nvaccess/nvda

Issue:
App module handler/system tests: "does app module exist" function throws attribute error if invoked from system test spy
Hi,

First of several major issues for system tests:

### Steps to reproduce:
1. Check out Python 3 staging branch.
2. Apply fixes such as basestring to str.
3. Run system tests (scons systemTests).

### Actual behavior:
appModuleHandler.doesAppModuleExist function throws AttributeError, causing system tests to fail.

### Expected behavior:
System test passes.

### System configuration
#### NVDA installed/portable/running from source:
Source

#### NVDA version:
Python 3 staging

#### Windows version:
Windows 10 Version 1903

#### Name and version of other software in use when reproducing the issue:
None

#### Other information about your system:
None

### Other questions
#### Does the issue still occur after restarting your PC?
Yes

#### Have you tried any other versions of NVDA? If so, please report their behaviors.
Python 2: system test passes.

### Additional context:
When system test spy is run, app module handler isn't initialized, causing importers (a private list) to remain uninitialized - remain None. Python 3 is strict about this. One solution is to catch attribute error in the affected function.

Thanks.


Discussion:

Resolving patch:
diff --git a/source/config/__init__.py b/source/config/__init__.py
--- a/source/config/__init__.py
+++ b/source/config/__init__.py
@@ -338,6 +338,9 @@ def addConfigDirsToPythonPackagePath(module, subdir=None):
 	if not subdir:
 		subdir = module.__name__
 	fullPath=os.path.join(getScratchpadDir(),subdir)
+	# Ensure this directory exists otherwise pkgutil.iter_importers may emit None for missing paths.
+	if not os.path.isdir(fullPath):
+		os.makedirs(fullPath)
 	# Insert this path at the beginning  of the module's search paths.
 	# The module's search paths may not be a mutable  list, so replace it with a new one 
 	pathList=[fullPath]


Test patch:
Repository: nvaccess/nvda

Issue:
Update check/Python 3: "bytes-like object is required" traceback when checking for updates
### Steps to reproduce:
For this one, Python 3 staging snapshot with update check fix must be in use with debug logging enabled:

1. Run Python 3 staging snapshot.
2. Try checking for updates.

### Actual behavior:
The following traceback is recorded:

DEBUGWARNING - updateCheck.UpdateChecker._bg (08:16:54.308):
Error checking for update
Traceback (most recent call last):
  File "updateCheck.py", line 232, in _bg
    info = checkForUpdate(self.AUTO)
  File "updateCheck.py", line 141, in checkForUpdate
    key, val = line.split(": ", 1)
TypeError: a bytes-like object is required, not 'str'

### Expected behavior:
No errors.

### System configuration
#### NVDA installed/portable/running from source:
Source and portable

#### NVDA version:
Python 3 staging 17843

#### Windows version:
Windows 10 Version 1903

#### Name and version of other software in use when reproducing the issue:
None

#### Other information about your system:
None

### Other questions
#### Does the issue still occur after restarting your PC?
Yes

#### Have you tried any other versions of NVDA? If so, please report their behaviors.
Yes - no errors in Python 2 releases.


Discussion:

Resolving patch:
diff --git a/source/updateCheck.py b/source/updateCheck.py
--- a/source/updateCheck.py
+++ b/source/updateCheck.py
@@ -137,7 +137,8 @@ def checkForUpdate(auto=False):
 		raise RuntimeError("Checking for update failed with code %d" % res.code)
 	info = {}
 	for line in res:
-		line = line.rstrip()
+		# #9819: update description resource returns bytes, so make it Unicode.
+		line = line.decode("utf-8").rstrip()
 		try:
 			key, val = line.split(": ", 1)
 		except ValueError:


Test patch:
Repository: nvaccess/nvda

Issue:
Braille: The fall-back input table does not match the default input table.
<!--
Please thoroughly read NVDA's wiki article on how to fill in this template, including how to provide the required files.
Issues may be closed if the required information is not present.
https://github.com/nvaccess/nvda/wiki/Github-issue-template-explanation-and-examples
-->

### Steps to reproduce:

Manually alter the configuration key ["braille"]["inputTable"] to an incorrect value.

### Actual behavior:

Braille input falls back to using `en-us-comp8.ctb`

### Expected behavior:

Braille input should fall back to using `en-ueb-g1.ctb`, as it is the default for a new configuration.

### System configuration
#### NVDA installed/portable/running from source:
Any
#### NVDA version:
>= 2017.3
#### Windows version:
N/A
#### Name and version of other software in use when reproducing the issue:
N/A
#### Other information about your system:

### Other questions
#### Does the issue still occur after restarting your PC?
Yes
#### Have you tried any other versions of NVDA? If so, please report their behaviors.



Discussion:

Resolving patch:
diff --git a/source/brailleInput.py b/source/brailleInput.py
--- a/source/brailleInput.py
+++ b/source/brailleInput.py
@@ -29,7 +29,7 @@
 """
 
 #: Table to use if the input table configuration is invalid.
-FALLBACK_TABLE = "en-us-comp8.ctb"
+FALLBACK_TABLE = "en-ueb-g1.ctb"
 DOT7 = 1 << 6
 DOT8 = 1 << 7
 #: This bit flag must be added to all braille cells when using liblouis with dotsIO.


Test patch:
Repository: nvaccess/nvda

Issue:
UIA in Windows consoles: Say all behaves incorrectly
<!--
Please thoroughly read NVDA's wiki article on how to fill in this template, including how to provide the required files.
Issues may be closed if the required information is not present.
https://github.com/nvaccess/nvda/wiki/Github-issue-template-explanation-and-examples
-->
### Steps to reproduce:
1. Turn on UIA in console
1. Open console
1. Press NVDA+up arrow twice fast
1. Press NVDA+down arrow

### Actual behavior:
NVDA walks backwards through the text, speaking one extra letter at a time.
```
>
f>
ef>
eef>
Reef>
\Reef>
s\Reef>
rs\Reef>
ers\Reef>
>
f>
ef>
eef>
Reef>
\Reef>
s\Reef>
rs\Reef>
ers\Reef>
C:\Users\Reef>
```

### Expected behavior:
Standard "say all" behaviour.

### System configuration
#### NVDA installed/portable/running from source:

#### NVDA version:
Running from source on `threshold_py3_staging` 
`beta-17939,fd65a653` seems to freeze.

#### Windows version:
Windows 10 - 1903
Build: 18362.175

#### Other information:

Quite possibly related to the textUtils offsets work.


Discussion:
The uniscribe code in there needs to be updated to use textUtils.

@feerrenrut: Just to make sure, don't you have this issue on master? I don't see how it could be related to uniscribe actually, as say all moves by line and uniscribe is only used for per word movement.
Just confirmed that this also affects master and threshold.

Resolving patch:
diff --git a/source/NVDAObjects/UIA/winConsoleUIA.py b/source/NVDAObjects/UIA/winConsoleUIA.py
--- a/source/NVDAObjects/UIA/winConsoleUIA.py
+++ b/source/NVDAObjects/UIA/winConsoleUIA.py
@@ -34,7 +34,7 @@ def collapse(self,end=False):
 		# textRange back one character.
 		# Correct this by bringing the start back up to where the end is.
 		oldInfo=self.copy()
-		super(consoleUIATextInfo,self).collapse()
+		super(consoleUIATextInfo,self).collapse(end=end)
 		if not end:
 			self._rangeObj.MoveEndpointByRange(
 				UIAHandler.TextPatternRangeEndpoint_Start,


Test patch:
Repository: nvaccess/nvda

Issue:
Browseable Messages - Centered and enlarged
<!--
Please thoroughly read NVDA's wiki article on how to fill in this template, including how to provide the required files.
Issues may be closed if the required information is not present.
https://github.com/nvaccess/nvda/wiki/Github-issue-template-explanation-and-examples
-->

### Is your feature request related to a problem? Please describe.

Browseable messages, as produced with `ui.browseableMessage` are shown in a tiny window, located near the top-left corner of the display, sometimes partially off-screen.

These limitations do not encourage authors to leverage the offered functionality - currently used only for format related info.

Looking at the source, it is clear the original intention was to have the window centered on the screen:
`DIALOG_OPTIONS = "dialogWidth:350px;dialogHeight:140px;resizable:yes;center:yes;help:no"`

The "center" option, which defaults to "yes", is misinterpreted at least with newer Internet Explorer versions. To obtain the desired behavior - a centered window - it should be removed.

### Describe the solution you'd like

- Remove the "center" option to preserve its "yes" default.
- Remove the height and width options to obtain a somewhat bigger default size window.

### Describe alternatives you've considered

### Additional context

Upcoming PR


Discussion:

Resolving patch:
diff --git a/source/ui.py b/source/ui.py
--- a/source/ui.py
+++ b/source/ui.py
@@ -25,7 +25,7 @@
 URL_MK_UNIFORM = 1
 
 # Dialog box properties
-DIALOG_OPTIONS = "dialogWidth:350px;dialogHeight:140px;resizable:yes;center:yes;help:no"
+DIALOG_OPTIONS = "resizable:yes;help:no"
 
 #dwDialogFlags for ShowHTMLDialogEx from mshtmhst.h
 HTMLDLG_NOUI = 0x0010 


Test patch:
Repository: nvaccess/nvda

Issue:
Installer/Python 3: type error thrown when attempting to perform a fresh NVDA instlal with no other versions present
Hi,

To @LeonardDer, another symptom of comparison with None:

### Steps to reproduce:
Try installing a fresh copy of NVDA Python 3 staging snapshot on a system without any NVDA version installed. This is easily accomplished through Windows Sandbox (Windows 10 Version 1903).

### Actual behavior:
The following traceback is printed when attempting to install NVDA (after choosing to do so from the launcher)

ERROR - unhandled exception (17:55:56.772):
Traceback (most recent call last):
  File "gui\__init__.pyc", line 747, in <lambda>
  File "gui\__init__.pyc", line 777, in onAction
  File "gui\__init__.pyc", line 351, in onInstallCommand
  File "gui\installerGui.pyc", line 263, in showInstallGui
TypeError: '>' not supported between instances of 'NoneType' and 'int'

### Expected behavior:
No errors.

### System configuration
#### NVDA installed/portable/running from source:
Not installed

#### NVDA version:
Python 3 staging 18054

#### Windows version:
Windows 10 Version 1903 Sandbox

#### Name and version of other software in use when reproducing the issue:
None

#### Other information about your system:
Tested inside Windows Sandbox.

### Other questions
#### Does the issue still occur after restarting your PC?
Yes

#### Have you tried any other versions of NVDA? If so, please report their behaviors.
Yes - no issues with lapha, current Threshold, and 2019.1.1.

### Additional context:
The install comparison function found in installer returns None when no version of NVDA is found on a system. The actual installer GUI doesn't know that the installer function returns None and proceeds to compare the return value as though it is an integer.

Thanks.


Discussion:

Resolving patch:
diff --git a/source/gui/installerGui.py b/source/gui/installerGui.py
--- a/source/gui/installerGui.py
+++ b/source/gui/installerGui.py
@@ -260,7 +260,7 @@ def __init__(self):
 def showInstallGui():
 	gui.mainFrame.prePopup()
 	previous = installer.comparePreviousInstall()
-	if previous > 0:
+	if previous is not None and previous > 0:
 		# The existing installation is newer, which means this will be a downgrade.
 		d = InstallingOverNewerVersionDialog()
 		with d:


Test patch:
Repository: nvaccess/nvda

Issue:
jump to selection start marker
**Reported by peter on 2011-11-27 11:09**
Hi all,
Is it possible to give the user a possibility to quickly move review cursor to the position of "start of text to be copyed" (nvda+f9)? This should be useful in many situations, e.g. temporary placemarker replacement in virtual buffers, hopefully workaround for patented fs functionality.



Discussion:
Interesting thought, but this shouldn't be a replacements for placemarkers IMO.
cc: @feerrenrut

Resolving patch:
diff --git a/source/globalCommands.py b/source/globalCommands.py
--- a/source/globalCommands.py
+++ b/source/globalCommands.py
@@ -1937,6 +1937,27 @@ def script_review_markStartForCopy(self, gesture):
 	script_review_markStartForCopy.__doc__ = _("Marks the current position of the review cursor as the start of text to be selected or copied")
 	script_review_markStartForCopy.category=SCRCAT_TEXTREVIEW
 
+	@script(
+		# Translators: Input help mode message for move review cursor to marked start position for a
+		# select or copy command
+		description=_(
+			"Move the review cursor to the position marked as the start of text to be selected or copied"
+		),
+		category=SCRCAT_TEXTREVIEW,
+		gesture="kb:NVDA+shift+F9",
+	)
+	def script_review_moveToStartMarkedForCopy(self, gesture):
+		pos = api.getReviewPosition()
+		if not getattr(pos.obj, "_copyStartMarker", None):
+			# Translators: Presented when attempting to move to the start marker for copy but none has been set.
+			ui.reviewMessage(_("No start marker set"))
+			return
+		startMarker = pos.obj._copyStartMarker.copy()
+		api.setReviewPosition(startMarker)
+		startMarker.collapse()
+		startMarker.expand(textInfos.UNIT_CHARACTER)
+		speech.speakTextInfo(startMarker, unit=textInfos.UNIT_CHARACTER, reason=controlTypes.REASON_CARET)
+
 	def script_review_copy(self, gesture):
 		pos = api.getReviewPosition().copy()
 		if not getattr(pos.obj, "_copyStartMarker", None):


Test patch: