Skip to content

Commit 0020188

Browse files
author
denfromufa
committed
Update pyobject.cs
1 parent 641eeba commit 0020188

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/runtime/pyobject.cs

+11-6
Original file line numberDiff line numberDiff line change
@@ -368,8 +368,9 @@ public virtual PyObject GetItem(PyObject key) {
368368
/// </remarks>
369369

370370
public virtual PyObject GetItem(string key) {
371-
using (PyString pyKey = new PyString(key))
371+
using (PyString pyKey = new PyString(key)) {
372372
return GetItem(pyKey);
373+
}
373374
}
374375

375376

@@ -384,8 +385,9 @@ public virtual PyObject GetItem(string key) {
384385
/// </remarks>
385386

386387
public virtual PyObject GetItem(int index) {
387-
PyInt key = new PyInt(index);
388-
return GetItem((PyObject)key);
388+
using (PyInt key = new PyInt(index)) {
389+
return GetItem((PyObject)key);
390+
}
389391
}
390392

391393

@@ -418,8 +420,9 @@ public virtual void SetItem(PyObject key, PyObject value) {
418420
/// </remarks>
419421

420422
public virtual void SetItem(string key, PyObject value) {
421-
using (PyString pyKey = new PyString(key))
423+
using (PyString pyKey = new PyString(key)) {
422424
SetItem(pyKey, value);
425+
}
423426
}
424427

425428

@@ -469,8 +472,9 @@ public virtual void DelItem(PyObject key) {
469472
/// </remarks>
470473

471474
public virtual void DelItem(string key) {
472-
using (PyString pyKey = new PyString(key))
475+
using (PyString pyKey = new PyString(key)) {
473476
DelItem(pyKey);
477+
}
474478
}
475479

476480

@@ -485,8 +489,9 @@ public virtual void DelItem(string key) {
485489
/// </remarks>
486490

487491
public virtual void DelItem(int index) {
488-
using (PyInt pyindex = new PyInt(index))
492+
using (PyInt pyindex = new PyInt(index)) {
489493
DelItem(pyindex);
494+
}
490495
}
491496

492497

0 commit comments

Comments
 (0)