Skip to content

Commit

Permalink
Fixed failed test cases.
Browse files Browse the repository at this point in the history
  • Loading branch information
lextm committed Nov 4, 2024
1 parent b5a542e commit a1a719e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pysnmp/smi/rfc1902.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import warnings

from pyasn1.error import PyAsn1Error
from pyasn1.type.base import AbstractSimpleAsn1Item
from pyasn1.type.base import AbstractSimpleAsn1Item, SimpleAsn1Type
from pysnmp import debug
from pysnmp.proto import rfc1902, rfc1905
from pysnmp.proto.api import v2c
Expand Down Expand Up @@ -1052,11 +1052,14 @@ class instance representing MIB browsing functionality.
return self

try:
old_value = self.__args[1]._value
keep_old_value = isinstance(self.__args[1], SimpleAsn1Type)
if keep_old_value:
old_value = self.__args[1]._value
self.__args[1] = (
object_identity.get_mib_node().getSyntax().clone(self.__args[1])
)
self.__args[1]._value = old_value # force to keep the original value
if keep_old_value:
self.__args[1]._value = old_value # force to keep the original value
except PyAsn1Error:
err = "MIB object %r having type %r failed to cast value " "%r: %s" % (
object_identity.prettyPrint(),
Expand Down

0 comments on commit a1a719e

Please sign in to comment.