Skip to content

Commit 9f4986e

Browse files
authored
Merge pull request #74 from intersystems/fix-73
Fix issue with [ Language = python ] methods with quoted names
2 parents b837cb4 + 1282ed1 commit 9f4986e

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [4.1.1] - Unreleased
9+
10+
### Fixed
11+
- #73: No longer errors when a `[ Language = python ]` method has quoted name like "__iter__"
12+
813
## [4.1.0] - 2025-11-13
914

1015
### Added

cls/TestCoverage/Data/CodeUnit.cls

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,10 @@ Method UpdateSourceMap(pSourceNamespace As %String, ByRef pCache) As %Status
405405
// %Foo() becomes _Foo() in the Python code unit.
406406
Set tCLSMethodNum = pCLSCodeUnit.MethodMap.GetAt($Replace(tMethod,"_","%"))
407407
}
408+
If (tCLSMethodNum = "") {
409+
// Special Python methods like __iter__ are stored as "__iter__" (with quotes) in CLS
410+
Set tCLSMethodNum = pCLSCodeUnit.MethodMap.GetAt(""""_tMethod_"""")
411+
}
408412
Set tMethodStart = ..MethodMap.GetAt(tMethod)
409413
Set tMethodEnd = ..MethodEndMap.GetAt(tMethod)
410414
Set tMethodName = tMethod

internal/testing/unit_tests/UnitTest/TestCoverage/Unit/CodeUnit.cls

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,4 +164,9 @@ ClassMethod PythonWeirdSpacing() [ Language = python ]
164164
return [element * 2 for element in x]
165165
}
166166

167+
Method "__iter__"() [ Language = python ]
168+
{
169+
return self
170+
}
171+
167172
}

0 commit comments

Comments
 (0)