Commit d13b66c
committed
Make __enter__ and __exit__ slots work with "with" statements
The problem was that the "with" statement doesn't use the conventional __getattr__ access, but directly accesses the tp_dict of the type, which usually is empty in PythonQt, so we had to put the __enter__ and __exit__ methods there, too.
And for binding the methods to the instance, tp_descr_get was used in this case, so we had to implement that for slots, too.
Discussed with and reviewed by Florian Link1 parent 720a3c2 commit d13b66c
3 files changed
+43
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1924 | 1924 | | |
1925 | 1925 | | |
1926 | 1926 | | |
| 1927 | + | |
| 1928 | + | |
| 1929 | + | |
| 1930 | + | |
| 1931 | + | |
| 1932 | + | |
| 1933 | + | |
| 1934 | + | |
| 1935 | + | |
| 1936 | + | |
| 1937 | + | |
| 1938 | + | |
| 1939 | + | |
| 1940 | + | |
| 1941 | + | |
| 1942 | + | |
| 1943 | + | |
| 1944 | + | |
| 1945 | + | |
| 1946 | + | |
| 1947 | + | |
| 1948 | + | |
| 1949 | + | |
| 1950 | + | |
| 1951 | + | |
| 1952 | + | |
1927 | 1953 | | |
1928 | 1954 | | |
1929 | 1955 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
208 | 208 | | |
209 | 209 | | |
210 | 210 | | |
| 211 | + | |
| 212 | + | |
211 | 213 | | |
212 | 214 | | |
213 | 215 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
790 | 790 | | |
791 | 791 | | |
792 | 792 | | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
793 | 807 | | |
794 | 808 | | |
795 | 809 | | |
| |||
827 | 841 | | |
828 | 842 | | |
829 | 843 | | |
| 844 | + | |
830 | 845 | | |
831 | 846 | | |
832 | 847 | | |
| |||
0 commit comments