https://github.com/DeinAlptraum closed
https://github.com/llvm/llvm-project/pull/138103
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/DeinAlptraum updated
https://github.com/llvm/llvm-project/pull/138103
>From 65ad7a888dafc9992793baee8a1ccc27f1b79fa5 Mon Sep 17 00:00:00 2001
From: Jannick Kremer
Date: Thu, 1 May 2025 18:37:43 +0900
Subject: [PATCH 01/10] [libclang/python] Add typing annotations for the Curs
@@ -77,6 +77,8 @@ Clang Frontend Potentially Breaking Changes
Clang Python Bindings Potentially Breaking Changes
--
+- Calling methods on null-cursors now leads to an exception.
+- ``Cursor.from_location`` now returns ``None`` in
https://github.com/DeinAlptraum updated
https://github.com/llvm/llvm-project/pull/138103
Rate limit · GitHub
body {
background-color: #f6f8fa;
color: #24292e;
font-family: -apple-system,BlinkMacSystemFont,Segoe
UI,Helvetica,Arial,s
https://github.com/Endilll edited
https://github.com/llvm/llvm-project/pull/138103
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -77,6 +77,8 @@ Clang Frontend Potentially Breaking Changes
Clang Python Bindings Potentially Breaking Changes
--
+- Calling methods on null-cursors now leads to an exception.
Endilll wrote:
```suggestion
- Al
https://github.com/Endilll commented:
Can you swap release notes entries? They will make more sense this way when my
suggestions are applied
https://github.com/llvm/llvm-project/pull/138103
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https
@@ -77,6 +77,8 @@ Clang Frontend Potentially Breaking Changes
Clang Python Bindings Potentially Breaking Changes
--
+- Calling methods on null-cursors now leads to an exception.
+- ``Cursor.from_location`` now returns ``None`` in
https://github.com/Endilll edited
https://github.com/llvm/llvm-project/pull/138103
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -1545,6 +1545,16 @@ class ExceptionSpecificationKind(BaseEnumeration):
### Cursors ###
+# This guard is used to ensure that no operations are possible on null cursors
Endilll wrote:
Yes, I think documentation on hover is helpful, which doesn't work withou
@@ -1552,68 +1563,83 @@ class Cursor(Structure):
_fields_ = [("_kind_id", c_int), ("xdata", c_int), ("data", c_void_p * 3)]
+_tu: TranslationUnit
+
@staticmethod
-def from_location(tu, location):
+def from_location(tu: TranslationUnit, location: SourceLoc
https://github.com/DeinAlptraum updated
https://github.com/llvm/llvm-project/pull/138103
Rate limit · GitHub
body {
background-color: #f6f8fa;
color: #24292e;
font-family: -apple-system,BlinkMacSystemFont,Segoe
UI,Helvetica,Arial,s
@@ -1763,19 +1799,22 @@ def get_usr(self):
another translation unit."""
return _CXString.from_result(conf.lib.clang_getCursorUSR(self))
-def get_included_file(self):
+@cursor_null_guard
+def get_included_file(self) -> File:
"""Returns the F
@@ -1763,19 +1799,22 @@ def get_usr(self):
another translation unit."""
return _CXString.from_result(conf.lib.clang_getCursorUSR(self))
-def get_included_file(self):
+@cursor_null_guard
+def get_included_file(self) -> File:
"""Returns the F
@@ -1545,6 +1545,16 @@ class ExceptionSpecificationKind(BaseEnumeration):
### Cursors ###
+# This guard is used to ensure that no operations are possible on null cursors
DeinAlptraum wrote:
I added the docstring, but are you sure this makes sense on a decora
@@ -1552,68 +1553,85 @@ class Cursor(Structure):
_fields_ = [("_kind_id", c_int), ("xdata", c_int), ("data", c_void_p * 3)]
+_tu: TranslationUnit
+
+# This ensures that no operations are possible on null cursors
+# by guarding all method calls with a not-null
https://github.com/DeinAlptraum commented:
Adressed all review comments and added a release note for the breaking changes.
https://github.com/llvm/llvm-project/pull/138103
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/c
https://github.com/DeinAlptraum edited
https://github.com/llvm/llvm-project/pull/138103
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/DeinAlptraum updated
https://github.com/llvm/llvm-project/pull/138103
>From 65ad7a888dafc9992793baee8a1ccc27f1b79fa5 Mon Sep 17 00:00:00 2001
From: Jannick Kremer
Date: Thu, 1 May 2025 18:37:43 +0900
Subject: [PATCH 1/7] [libclang/python] Add typing annotations for the Cursor
https://github.com/Endilll commented:
Can you also add a release note?
https://github.com/llvm/llvm-project/pull/138103
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -1552,68 +1553,85 @@ class Cursor(Structure):
_fields_ = [("_kind_id", c_int), ("xdata", c_int), ("data", c_void_p * 3)]
+_tu: TranslationUnit
+
+# This ensures that no operations are possible on null cursors
+# by guarding all method calls with a not-null
@@ -1552,68 +1563,83 @@ class Cursor(Structure):
_fields_ = [("_kind_id", c_int), ("xdata", c_int), ("data", c_void_p * 3)]
+_tu: TranslationUnit
+
@staticmethod
-def from_location(tu, location):
+def from_location(tu: TranslationUnit, location: SourceLoc
@@ -1763,19 +1799,22 @@ def get_usr(self):
another translation unit."""
return _CXString.from_result(conf.lib.clang_getCursorUSR(self))
-def get_included_file(self):
+@cursor_null_guard
+def get_included_file(self) -> File:
"""Returns the F
@@ -1821,45 +1824,45 @@ def mangled_name(self):
return self._mangled_name
@property
-def location(self):
+def location(self) -> SourceLocation:
"""
Return the source location (the starting character) of the entity
pointed at by th
@@ -1545,6 +1545,16 @@ class ExceptionSpecificationKind(BaseEnumeration):
### Cursors ###
+# This guard is used to ensure that no operations are possible on null cursors
Endilll wrote:
I think this comment should also go into high-level matters (that null cu
https://github.com/DeinAlptraum updated
https://github.com/llvm/llvm-project/pull/138103
>From 65ad7a888dafc9992793baee8a1ccc27f1b79fa5 Mon Sep 17 00:00:00 2001
From: Jannick Kremer
Date: Thu, 1 May 2025 18:37:43 +0900
Subject: [PATCH 1/5] [libclang/python] Add typing annotations for the Cursor
https://github.com/DeinAlptraum edited
https://github.com/llvm/llvm-project/pull/138103
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -1552,68 +1553,85 @@ class Cursor(Structure):
_fields_ = [("_kind_id", c_int), ("xdata", c_int), ("data", c_void_p * 3)]
+_tu: TranslationUnit
+
+# This ensures that no operations are possible on null cursors
+# by guarding all method calls with a not-null
@@ -1552,68 +1553,85 @@ class Cursor(Structure):
_fields_ = [("_kind_id", c_int), ("xdata", c_int), ("data", c_void_p * 3)]
+_tu: TranslationUnit
+
+# This ensures that no operations are possible on null cursors
+# by guarding all method calls with a not-null
@@ -1913,7 +1916,7 @@ def type(self):
return self._type
@property
-def canonical(self):
+def canonical(self) -> Cursor | None:
"""Return the canonical Cursor corresponding to this Cursor.
DeinAlptraum wrote:
That's a good idea, I
@@ -1821,45 +1824,45 @@ def mangled_name(self):
return self._mangled_name
@property
-def location(self):
+def location(self) -> SourceLocation:
"""
Return the source location (the starting character) of the entity
pointed at by th
https://github.com/DeinAlptraum updated
https://github.com/llvm/llvm-project/pull/138103
Rate limit · GitHub
body {
background-color: #f6f8fa;
color: #24292e;
font-family: -apple-system,BlinkMacSystemFont,Segoe
UI,Helvetica,Arial,s
https://github.com/Endilll edited
https://github.com/llvm/llvm-project/pull/138103
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -1821,45 +1824,45 @@ def mangled_name(self):
return self._mangled_name
@property
-def location(self):
+def location(self) -> SourceLocation:
"""
Return the source location (the starting character) of the entity
pointed at by th
https://github.com/DeinAlptraum updated
https://github.com/llvm/llvm-project/pull/138103
Rate limit · GitHub
body {
background-color: #f6f8fa;
color: #24292e;
font-family: -apple-system,BlinkMacSystemFont,Segoe
UI,Helvetica,Arial,s
https://github.com/DeinAlptraum edited
https://github.com/llvm/llvm-project/pull/138103
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -1913,7 +1916,7 @@ def type(self):
return self._type
@property
-def canonical(self):
+def canonical(self) -> Cursor | None:
"""Return the canonical Cursor corresponding to this Cursor.
DeinAlptraum wrote:
Okay, I did find a way
https://github.com/DeinAlptraum updated
https://github.com/llvm/llvm-project/pull/138103
Rate limit · GitHub
body {
background-color: #f6f8fa;
color: #24292e;
font-family: -apple-system,BlinkMacSystemFont,Segoe
UI,Helvetica,Arial,s
@@ -1821,45 +1824,45 @@ def mangled_name(self):
return self._mangled_name
@property
-def location(self):
+def location(self) -> SourceLocation:
"""
Return the source location (the starting character) of the entity
pointed at by th
@@ -1913,7 +1916,7 @@ def type(self):
return self._type
@property
-def canonical(self):
+def canonical(self) -> Cursor | None:
"""Return the canonical Cursor corresponding to this Cursor.
Endilll wrote:
> That said, the input to i
https://github.com/DeinAlptraum edited
https://github.com/llvm/llvm-project/pull/138103
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/DeinAlptraum edited
https://github.com/llvm/llvm-project/pull/138103
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -1913,7 +1916,7 @@ def type(self):
return self._type
@property
-def canonical(self):
+def canonical(self) -> Cursor | None:
"""Return the canonical Cursor corresponding to this Cursor.
DeinAlptraum wrote:
This uses `Cursor.from
@@ -1821,45 +1824,45 @@ def mangled_name(self):
return self._mangled_name
@property
-def location(self):
+def location(self) -> SourceLocation:
"""
Return the source location (the starting character) of the entity
pointed at by th
https://github.com/DeinAlptraum edited
https://github.com/llvm/llvm-project/pull/138103
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/DeinAlptraum commented:
When this is merged we can finally close #120590
Some other notes:
https://github.com/llvm/llvm-project/pull/138103
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailm
https://github.com/DeinAlptraum edited
https://github.com/llvm/llvm-project/pull/138103
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/DeinAlptraum updated
https://github.com/llvm/llvm-project/pull/138103
>From f47dfd697658600dd387162c908c43079da2774f Mon Sep 17 00:00:00 2001
From: Jannick Kremer
Date: Thu, 1 May 2025 18:37:43 +0900
Subject: [PATCH 1/2] [libclang/python] Add typing annotations for the Cursor
https://github.com/DeinAlptraum updated
https://github.com/llvm/llvm-project/pull/138103
>From d03f89a960e4fd57be2c37ee4c0cd59b5c784316 Mon Sep 17 00:00:00 2001
From: Jannick Kremer
Date: Thu, 1 May 2025 18:37:43 +0900
Subject: [PATCH 1/2] [libclang/python] Add typing annotations for the Cursor
github-actions[bot] wrote:
:warning: Python code formatter, darker found issues in your code. :warning:
You can test this locally with the following command:
``bash
darker --check --diff -r HEAD~1...HEAD clang/bindings/python/clang/cindex.py
``
View the diff from dark
llvmbot wrote:
@llvm/pr-subscribers-clang
Author: Jannick Kremer (DeinAlptraum)
Changes
---
Patch is 22.11 KiB, truncated to 20.00 KiB below, full version:
https://github.com/llvm/llvm-project/pull/138103.diff
1 Files Affected:
- (modified) clang/bindings/python/clang/cindex.py (+80
https://github.com/DeinAlptraum created
https://github.com/llvm/llvm-project/pull/138103
None
>From d03f89a960e4fd57be2c37ee4c0cd59b5c784316 Mon Sep 17 00:00:00 2001
From: Jannick Kremer
Date: Thu, 1 May 2025 18:37:43 +0900
Subject: [PATCH] [libclang/python] Add typing annotations for the Curs
52 matches
Mail list logo