@@ -709,18 +709,18 @@ def unit(self, unit):
709709 # First, parse the unit in the default way, so that we can
710710 # still emit a warning if the unit is not to spec.
711711 default_format = _get_default_unit_format (self ._config )
712- unit = u .Unit (
712+ unit_obj = u .Unit (
713713 unit , format = default_format , parse_strict = 'silent' )
714- if isinstance (unit , u .UnrecognizedUnit ):
715- warn_or_raise (W50 , W50 , (unit . to_string () ,),
714+ if isinstance (unit_obj , u .UnrecognizedUnit ):
715+ warn_or_raise (W50 , W50 , (unit ,),
716716 self ._config , self ._pos )
717717
718718 format = _get_unit_format (self ._config )
719719 if format != default_format :
720- unit = u .Unit (
720+ unit_obj = u .Unit (
721721 unit , format = format , parse_strict = 'silent' )
722722
723- self ._unit = unit
723+ self ._unit = unit_obj
724724
725725 @unit .deleter
726726 def unit (self ):
@@ -1294,18 +1294,18 @@ def unit(self, unit):
12941294 # First, parse the unit in the default way, so that we can
12951295 # still emit a warning if the unit is not to spec.
12961296 default_format = _get_default_unit_format (self ._config )
1297- unit = u .Unit (
1297+ unit_obj = u .Unit (
12981298 unit , format = default_format , parse_strict = 'silent' )
1299- if isinstance (unit , u .UnrecognizedUnit ):
1300- warn_or_raise (W50 , W50 , (unit . to_string () ,),
1299+ if isinstance (unit_obj , u .UnrecognizedUnit ):
1300+ warn_or_raise (W50 , W50 , (unit ,),
13011301 self ._config , self ._pos )
13021302
13031303 format = _get_unit_format (self ._config )
13041304 if format != default_format :
1305- unit = u .Unit (
1305+ unit_obj = u .Unit (
13061306 unit , format = format , parse_strict = 'silent' )
13071307
1308- self ._unit = unit
1308+ self ._unit = unit_obj
13091309
13101310 @unit .deleter
13111311 def unit (self ):
0 commit comments